Azure のアクショングループが無邪気にたくさん作られてしまっていて整理したいのだが、Azure Portal の UI からは「このアクショングループがどこで使われているか」を見ることができない。
そういうときは Azure Resource Graph Explorer から KQL クエリを実行することで紐づいているリソースを列挙することができる。
resources
| where type =~ 'microsoft.insights/actiongroups'
| project actionGroupId = tolower(id), actionGroupName = name
| join kind=leftouter (
resources
| where type =~ 'microsoft.insights/metricalerts'
| mv-expand properties['actions']
| project actionGroupId = tolower(tostring(properties_actions['actionGroupId'])), metricAlertId = id, metricAlertName = name
) on actionGroupId
| project actionGroupId, actionGroupName, metricAlertId, metricAlertName
上記例ではアクショングループに紐づいているメトリクスアラート一覧を列挙したが、メトリクスアラート以外でアクショングループが使用されている場合は表示されないので注意されたい。