Azure: Finding Orphan Smart Detector Alert
This query can help you to identify the orphan smart detector alerts – there is also a command column which can help you to run it in shell.portal.com resources | where type in (“microsoft.alertsmanagement/smartdetectoralertrules”)| project subscriptionId, id,name,resourceGroup,properties.actionGroups.groupIds[0] , properties.scope[0] | project-rename alert_id = id, alert_subscription=subscriptionId,alert_name=name,target_id=properties_scope_0,actionGroupId=properties_actionGroups_groupIds_0 | extend target_id=tolower(tostring(target_id)) | join kind=leftouter ( resources | project id,name,type,resourceGroup,subscriptionId | extend id=tolower(tostring(id))) on $left.target_id==$right.id | where name==”” | extend target_name=split(target_id,”/”)[-1] |extend cmd_delete=strcat(“az resource delete –ids \””, alert_id,”\””)Read More →