Azure PowerTip 4: Unable to Connect to Azure Sql Database. IP Address is not allowed to access server.

When using Sql Databases on Azure, the firewall on the db server blocks requests from unknown IPs. This means that when you try to connect from a client such as Sql Server Management Studio (SSMS) or Visual Studio, your request to connect to the db is rejected with the following message:

Cannot connect to

Cannot open server ‘mmedb’ requested by the login. Client with IP address ‘’ 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. (Microsoft SQL Server, Error: 40615)


What you need to do is configure the firewall on the Azure Database Server to allow a connection from your local IP Address. Follow these steps:

1. Go to the Azure Portal and navigate to your database

2. On the blade for your database, click the link to the db server on the upper right corner.


3. Once you are on your db servers blade, click “Firewall” from the options on the left hand side.


4. On the firewall blade, click the “Add client IP” button on the top. This adds your current IP address to the rule list. Don’t forget to give it a meaningfull name in order to be able to remove it later. (if you don’t need it anymore).


5. Click “Save”.

Note that it can take several minutes even AFTER the setting changes is confirmed in the portal until you can login to your database.

Talk 18.03.2017–Trivadis TechEvent– Visual Studio 2017 Productivity Tools
Azure PowerTip 5: Setting up an Sql Server with the Adventureworks Sample Database in 2 Minutes

0 Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.

15 49.0138 8.38624 1 0 4000 1 300 0