Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
bash script to set firewall rules for an Azure Database for MySQL instace
#!/bin/sh
azuresub=$1
demoresourcegroup=$2
mysqlservername=$3
firstip=$4
secondip=$5
thirdip=$6
fourthip=$7
# uncomment to add local support and login to your Azure subscription
# az login
az account set --subscription $azuresub
az mysql server firewall-rule create --resource-group $demoresourcegroup --server-name $mysqlservername --name allowwebapp01 --start-ip-address $firstip --end-ip-address $firstip
az mysql server firewall-rule create --resource-group $demoresourcegroup --server-name $mysqlservername --name allowwebapp02 --start-ip-address $secondip --end-ip-address $secondip
az mysql server firewall-rule create --resource-group $demoresourcegroup --server-name $mysqlservername --name allowwebapp03 --start-ip-address $thirdip --end-ip-address $thirdip
az mysql server firewall-rule create --resource-group $demoresourcegroup --server-name $mysqlservername --name allowwebapp04 --start-ip-address $fourthip --end-ip-address $fourthip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.