Friday 31 July 2020

Allow Azure Services on SQL Server with Azure CLI

Allow Azure services on Azure SQL Server lets other Azure Services such as function apps, app service apps etc. to be connected to an Azure SQL Server without needing to allow the outbound IPs of such services. You can enable this easily using the portal. Let’s look at how we can Allow Azure services suing CLI.

The Azure portal lets you switch on off the setting in the Azure SQL Server firewall settings page as shown below.


However, setting this to Yes using Azure CLI requires to get a firewall rule added with start and end IP set as 0.0.0.0

az sql server firewall-rule create -g myresourcegroup -s mysqlserver -n myallowazsvcrule --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0

To set the Allow Azure services to No you should delete the firewall rule as shown below.

az sql server firewall-rule delete -g myresourcegroup -s mysqlserver -n myallowazsvcrule

No comments:

Popular Posts