Created
April 3, 2020 14:24
-
-
Save mattcuk/14aeedf7d24f0e807a1a02f55a2d28e8 to your computer and use it in GitHub Desktop.
List out all Azure resources that have Alerts set up (escapes Alert ID to get around issue with spaces)
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
alerts=$(az resource list --output tsv --resource-type "Microsoft.Insights/metricAlerts" --query [].id) | |
alerts=${alerts// /SPACEFIX} | |
for alert in $alerts | |
do | |
az resource show --ids "${alert//SPACEFIX/ }" --query properties.scopes[0] --output tsv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment