I have 70+ storage accounts in my Azure account. All of them have network settings configured to allow access from certain vnets and from allowed set of IP addresses. I now need to add several more IP ranges to each of these accounts - these are the same ranges for all accounts.
Storage accounts are in many different resource groups.
While I could of course go through each one individually and make the changes via the portal, this seems to me like a massive waste of time. Is there an easier/quicker way?
Use CLI (Bash example below). Execute this in cloud shell and it would iterate through all the storage accounts that you have access to in current subscription and create command to add a network rule (IP 12.34.56.78/24). Run and test a command manually and if it looks good, add | sh in the command to execute all
az storage account list --query '[].{ name: name, resourceGroup: resourceGroup }' -o tsv |
awk '{ print "az storage account network-rule add -g " $2 " --account-name " $1 " --ip-address 12.34.56.78/24" }'
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments