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 ‘18.104.22.168’ 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 22.214.171.124 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.
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.