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


Author: Arunraj

I am a Microsoft Certified Technology Specialist (Database Developer). I work on SQL Server programming since SQL Server 7.0 specializes in SQL Server Programming and Performance Tuning and has 14 years of hands-on experience. I hold a Master Degree in Computer Applications. I am also part of NJSQL User Group and Northern New Jersey .Net User Group.

One thought on “How to Configure SQL Azure Firewall using Queries”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: