Skip to content

Instantly share code, notes, and snippets.

@eosfor
Created February 1, 2022 08:55
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 eosfor/aec0f04a301e6278ff0b635c61f89078 to your computer and use it in GitHub Desktop.
Save eosfor/aec0f04a301e6278ff0b635c61f89078 to your computer and use it in GitHub Desktop.
pill alert rules and their action groups from azure where action groups have a webhook attached
$q = "resources
| where type == `"microsoft.insights/metricalerts`"
| extend prop = parse_json(properties)
| extend agId = tolower(tostring(prop.actions[0].actionGroupId))
| project metricsid = ['id'], mname = name, mresourceGroup = resourceGroup, agId
| join kind = inner ( resources
| where type == `"microsoft.insights/actiongroups`"
| extend prop = parse_json(properties)
| project actiongroupid = tolower(id), aname = name, aresourcegroup = resourceGroup, whURL = tostring(prop.webhookReceivers[0].serviceUri)
| where whURL != `"`")
on `$left.agId == `$right.actiongroupid
"
Search-AzGraph -Query $q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment