I am trying to add firewall rule But it can't be added(Eror: Failed to add rule ....Please add it manually). Then I have try to add it manually but problem is still cant save rule even manually (Error :Failed to Save Server Firewall Rules) This was running before some days but not working now. Unable to access azure sql database. Please help me to solve this
5 Answers
I just encountered the error as well, which prompted a thorough investigation.
Only after running set_firewall_rule sp directly on Master database with SuperAdmin user, did we get an error with root cause - in our case it was due to reaching an upper limit of IP records (128 apparently), I deleted some redundancies and was able to add new record as usual.
So frustrating that they couldn't provide this information in the error description, would have saved me a good 3 hours. Thanks Microsoft! :/
If the issue is an error with adding the rule to your Azure SQL Database via the management API, there are two options you can try.
The first is to try and do it via t-sql, providing you have somewhere you can connect SQL Management Studio to the database from. You can find this method described at: http://social.technet.microsoft.com/wiki/contents/articles/2677.windows-azure-sql-database-firewall-en-us.aspx#Changing_the_Firewall_Rules_Using_T-SQL
If this doesn't work, your only option may be to open a support ticket. Alternative, if you posted on the MSDN forums, support does sometimes respond and may be able to help you out from there.
I was stuck with the same error.
But in my case, I was trying to add more than 128 Firewall in the list.
In Azure SQL DB you can add up to 128 Firewall rules.
I tried below Query:
--create a firewall rule for a single IP address
exec sp_set_firewall_rule N'BondComputer','272.61.201.71','272.61.201.71'
--create a firewall rule for Microsoft services and Windows Azure services
exec sp_set_firewall_rule N'MicrosoftServices','0.0.0.0','0.0.0.0'
--delete a firewall rule
exec sp_delete_firewall_rule N'BondComputer'
--get a list of the firewall rules
select * from sys.firewall_rules
--Count should not be more than 128
select count(*) from sys.firewall_rules