How to access SQL Azure from anywhere or How to disable SQL Azure Firewall ?

After reading my previous post regarding SQL Azure firewall configuration, one of my friend asked Whether there is an easy way to provide access any IP Address, so that he don’t have to worry about not able to connect using 3G wireless card to connect to SQL Azure

Yes, there is an easy way to do that…

Login to SQL Azure Management Portal and select the subscription and the SQL Azure server for which you want to provide access and then click on “Firewall Rules


Click “Add”



Click “Ok” to save the Firewall rule

Now you should be able to access this SQL Azure server from anywhere in the world.

Note: Please be aware that by adding the above rule, the SQL Azure firewall is pretty much disabled effectively. Obviously this is not a recommended practice.


How to Configure SQL Azure Firewall using Queries

For connecting to SQL Azure, your IP Address should be added to SQL Azure Firewall, you can do this normally by SQL Azure Management Portal, but adding them one by one using Web Interface might be little difficult for SQL Azure Administrators

SQL Azure provides the following System Procedures to Manage SQL Azure Firewall policies

–To query the list of Active Firewall rules

SELECT * FROM sys.firewall_rules


To add a new IP Address or Range of IP Address to SQL Azure Firewall

–Query to Add or Update One or Range of IP Addresses to Firewall Policy

EXEC sys.sp_set_firewall_rule @name = N’Office’,
    @start_ip_address = ‘XXX.XXX.XXX.1’,
    @end_ip_address = ‘XXX.XXX.XXX.255’

–Query to Remove or Delete an IPAddress or IP Address Range from SQL Azure Firewall

EXEC sys.sp_delete_firewall_rule @name = N’Office’


If you look at the above screen shot, The policy with id 7 has been removed.

Using these System SPs, you can script your firewall policies and deploy them quickly on your new SQL Azure server, without having to use SQL Azure Management portal

%d bloggers like this: