This Azure tutorial will discuss how to fix the error. cannot open server requested By the login, which I got while trying to log in to the Azure SQL database.
Table of Contents
Cannot Open Server requested by the login. The login failed
Recently, I was working with a requirement to write a stored procedure in my Azure SQL DB. When logging in to the Query Editor (Preview), I got this error.
Login to the Azure Portal (https://portal.azure.com/)
Search for the SQL databases in the Azure Portal and click on the search result
You will see all your list of Azure SQL databases here. Click on the one that you want to use. Now click on the Query editor (preview) link from the left navigation on the SQL database page. Enter the Login Username and password and click on the Login button. You can able to see I got the below error.
The Exact error message was like below
Cannot open server ‘sql1246’ requested by the login. Client with IP address ‘106.##.106.###’ is not allowed to access the server. To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. It may take up to five minutes for this change to take effect. Set server firewall (sql1246)
Now we will see How to fix the error Cannot Open Server Requested By The Login.
Cannot Open Server requested by the login. The login failed [Solved]
To fix the error, you need to set the firewall for the SQL server(sql1246) in my case. Follow the below steps.
1. To set the firewall, click on the Set server firewall link from the error itself; else, you can search for the SQL Server in the Azure Portal and click on the search result.
You will get the list of SQL servers and click on the specific one for which you need to set the Firewall( You can see the complete error message to find the name of the SQL Server).
2. On the SQL server page, click on the Firewalls and virtual networks link from the left navigation. The next step is to click the + Add client IP button as highlighted below and add the Client IP address in the Rule name, Start IP, and End IP text boxes. (For the exact Client IP, refer to the complete error message). Finally, click on the Save button.
Once you click the Save button, you can find the pop-up below. Click on the OK button.
3. Now navigate to the Azure SQL Database and click on the Now click on the Query editor (preview) link from the left navigation on the Azure SQL database page. Enter the Login Username and password and click on the Login button. You will able to log in successfully as shown below
You may also like following the article below
Well, In this article, we discussed how to fix the error, Cannot Open Server requested by the login. The login failed., which I got while trying to log in to the Azure SQL database.
I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.