Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Azure PowerTip: Fixing ''IP Address Is Not Allowed to Access Server''

DZone's Guide to

Azure PowerTip: Fixing ''IP Address Is Not Allowed to Access Server''

Don't you love it when Azure blocks your IP address' access? No? Oh. Well, let's fix it so that your firewall lets you through to your SQL database.

· Database Zone
Free Resource

Learn how to create flexible schemas in a relational database using SQL for JSON.

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 mmedb.database.windows.net.

Cannot open server ‘mmedb’ requested by the login. Client with IP address ‘178.197.226.xxx’ 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)

image

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.

image

3. Once you are on your DB server's blade, click “Firewall” from the options on the left-hand side.

image

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 meaningful name in order to be able to remove it later. (If you don’t need it anymore).

image

5. Click “Save”

Note that it can take several minutes even AFTER the setting changes are confirmed in the portal for you to be able to log into your database.

Create flexible schemas using dynamic columns for semi-structured data. Learn how.

Topics:
microsoft sql server ,database ,microsoft azure ,database access

Published at DZone with permission of Manuel Meyer. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}