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 ‘169.149.200.249’ is not allowed to access the server.” as shown below in the image:

Reason
After some Google searching and studying the error, I learned why. There is a firewall in Azure SQL that protects the database from undesired connection requests.
In my case, the firewall also did not allow connections from my machine’s IP address. I needed to configure the firewall settings to enable the connection to request from my machine.
Solution
You can see the option Whitelist IP 169.149.200.249 on server mysql1000. You can click on this option to add your machine’s IP address to the firewall’s whitelist.
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. However, 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. Click on Set server firewall in the server Overview 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 to the firewall whitelist, click on Save to save the settings. Now, you will no longer get this error while accessing 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.