Applying IP Restrictions to a Large Set of Azure Resources
To do this, use PowerShell and Azure CLI to collect all of the NSGs and get all of the NSGs in the subscription:
Then go through every NSG and create the rule:
Next, get a list of the App Services:
And go through and add the list of IPs required (must use individual IPs):
Removing Access
To delete the same list of rules from the NSGs, use the same name:
Reference:
https://docs.microsoft.com/en-us/cli/azure/network/nsg?view=azure-cli-latest#az-network-nsg-list