Cannot open server 'xx' requested by the login. Client with IP address 'xx' is not allowed to access the server.

{tocify} $title={Table of Contents}


After creating new database, I tried login using Azure Portal Query Editor but I was presented with below error.

Allow ip on server

Why it happened

The database created, resides on the SQL server and by default Public access is set to Selected Networks (with no networks selected).

Public access option on sql server

And it is because while creating SQL database, I went ahead with default settings under Networking. 

no access setting in networking tab

What to do

As the error points to, in order to access the database, the ip address of the machine has to be added to the Allowlist under Firewall Rules of the SQL Server.

As I am trying to connect from my personal laptop, ip address has to be added explicitly. Option to add your client ip address is available automatically, just click on that ( highlighted in yellow).

If any other ip address has to be added then click on Add a Firewall rule

add ip in firewall

What if I want access to this database from machine which is in a virtual network?

For that , click on Add a virtual network rule and add the details

add a virtual network rule in SQL Server networking

If you have questions or suggestions, feel free to do in comments section below !!!

Do share if you find this helpful .......
                          Knowledge Sharing is Caring !!!!!!

Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post