Skip to content

Instantly share code, notes, and snippets.

@mattcuk
Created April 3, 2020 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattcuk/14aeedf7d24f0e807a1a02f55a2d28e8 to your computer and use it in GitHub Desktop.
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)
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