Created
December 4, 2017 06:02
-
-
Save ttamminen/6c40084339d1c2f010d3d86e5c36bc52 to your computer and use it in GitHub Desktop.
Set Azure SQL Server firewall using Azure CLI 2.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rulename = '' | |
$servername = '' | |
$resourcegroup = '' | |
$currentip = Invoke-WebRequest 'http://ipv4.icanhazip.com' | Select -Expand Content | |
$currentip = $currentip.Trim() | |
az sql server firewall-rule delete --name $rulename --resource-group $resourcegroup --server $servername | |
az sql server firewall-rule create --debug -n $rulename --resource-group $resourcegroup --server $servername --start-ip-address "$currentip" --end-ip-address "$currentip" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment