Azure MSSQL – Server Firewall Rules

Run these commands on the master table.

First get the existing rules

SELECT * FROM sys.firewall_rules ORDER BY name;

Based on the above query if there are any rules you need to remove get the name and replace Client with the appropriate name

EXECUTE sp_delete_firewall_rule @name = N'Client'

If you need to add an IP rule go to and update the script below with what is shown on the screen.

-- Create server-level firewall setting for only IP  
exec sp_set_firewall_rule N'Example setting 1','','';  

-- Update server-level firewall setting to also allow IP  
exec sp_set_firewall_rule N'Example setting 1','',''; 

Of course if you simply need to allow all Azure (be careful with this one)

-- Enable Windows Azure connections.  
exec sp_set_firewall_rule N'Allow Windows Azure','','';
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.