In this Azure SQL blog, I will share my incident when I got this error “Cannot open server requested by the login. client is not allowed to access the server“.
Cannot open server requested by the login. client is not allowed to access the server
Recently, I was working with the Azure SQL database. I created a new single Azure SQL database in Microsoft Azure and tried to connect to it from the portal.
I was not able to connect to the database and got the error “Cannot open server ‘mysql1000’ requested by the login. Client with IP address ‘188.8.131.52’ is not allowed to access the server.” as shown below in the image:
Reason: Cannot open server requested by the login
After some google searching and studying about the error, I got to know the reason behind this error. There is a firewall in Azure SQL that protects the database from undesired connection requests.
In my case also, the firewall was not allowing connections from my machine’s IP address. I needed to configure the firewall settings in order to allow the connection request from my machine.
Solution: Cannot open server requested by the login
You can see the option Whitelist IP 184.108.40.206 on server mysql1000. You can click on this option to add your machine’s IP address to the whitelist of the firewall.
Whitelisting IP means allowing only the specified IP address to access the database. But this is a temporary solution.
A better approach is to configure the firewall settings in Azure SQL. There are multiple ways to configure the firewall in Azure SQL. But, the easiest way is to do it from the Azure portal.
If you want to configure the firewall, open the Azure portal and go to the server on which you have created the database. In the server Overview, click on Set server firewall to open the firewall settings. See the below image for reference:
Once you have opened the firewall settings, you can see the option to add the IP address to the firewall whitelist. Here you can enter a single IP address or a range of IP addresses that can access the database.
You can also make multiple entries. There is an option of Add client IP. Clicking on this option will add your current IP address to the firewall whitelist.
After adding the desired IP addresses in the firewall whitelist, click on Save to save the settings. Now you will no longer get this error while trying to access the database. I followed the same steps and was able to connect to my Azure SQL database.
You may also like the following articles:
In this tutorial, we learned how to fix the error, cannot open server requested by the login. client is not allowed to access the server. This comes when I tried to connect to Azure SQL.
After working for more than 15 years in the Software field, especially in Microsoft technologies, I have decided to share my expert knowledge of SQL Server. Check out all the SQL Server and related database tutorials I have shared here. Most of the readers are from countries like the United States of America, the United Kingdom, New Zealand, Australia, Canada, etc. I am also a Microsoft MVP. Check out more here.