Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
az resource show --ids "${alert//SPACEFIX/ }" --query properties.scopes[0] --output tsv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment