Add An IP Address To An Azure SQL Database Firewall

Azure, Azure SQL Databases are quite secure and try to limit access to minimize security risks. This, is a great thing. That said, as developers, we often need to remotely access such tools to be able to perform our work.

So how can we do so?

The solution, in the case of Azure SQL Databases, is to create an exception for your IP address in the Firewall rules. Once you authorize your IP address, assuming you have proper login credentials, you will be able to go about your business and connect remotely to that Azure resource.

Adding A Firewall Rule

Once you know how, adding a firewall rule for an IP address so it can access your Azure SQL Database resource is child’s play.  Here’s what you need to do:

  1. Log into your Azure account at https://portal.azure.com
  2. On your Home page, locate and click on your SQL Database resource to open it
  3. On the Overview page (the page that should load by default), locate and click on the Set server firewall (should be located at the top near the middle of the page)

Adding an Exception For the Current PC

If the entry is for the current PC, locate and click on the button labeled ‘+ Add your client internet IPv4 address (xxx.xxx.xxx.xxx)

Upon clicking the button, a new entry for your current IP address will be added to the existing listing of rules and will have a Rule name following the generic naming:

ClientIPAddress_yyyy-m-d_hh-mm-ss

Finally, be sure to click on the Save button (at the bottom of the form) otherwise the entry will NOT be committed to the database.

Adding an Exception For Another PC/IP Address

If you are making an entry for another IP address then locate and click on the button labeled ‘Add a firewall rule‘ and a popup form will appear in which you will need to fill-in the requested information: Rule name, Start IP, En IP.

Once the form completed, simply press OK.

Note: If you are making an entry for a single IP address, not a range, simply enter the IP address in both the Start IP and End IP inputs.

At this point the new entry should appear in the existing listing of rules.

Now, be sure to click on the Save button (at the bottom of the form) otherwise the entry will NOT be committed to the database.

That’s all there is to giving IP addresses access to an Azure SQL Database!