The subscription activity log is being sent to a Log Analytics workspace. An alert must fire when any resource group is deleted, but delete operations initiated by the automation account rg-cleaner@contoso.com must be ignored. Which query should be used in the alert rule?
This query targets the exact delete operation for resource groups in AzureActivity, limits results to successful deletions, and excludes the automation account caller. A log alert can trigger when the result count is greater than zero. It is the most accurate choice because it filters by both operation identity and exception handling, which prevents false alerts from the known automation runbook.
Why this answer
It filters for the exact operation that deletes a resource group (Microsoft.Resources/subscriptions/resourceGroups/delete), ensures the deletion succeeded, and excludes the caller 'rg-cleaner@contoso.com'. This meets the requirement to fire an alert only when a resource group is deleted by any user except the automation account.
Exam trap
The trap here is that candidates often choose Option A because they see 'delete' in the operation name, but they fail to realize that a broad 'contains' filter will match many unrelated delete operations and does not exclude the automation account's caller identity.
Why the other options are wrong
This query does not filter by the specific resource group delete operation (OperationNameValue) and does not exclude the automation account caller. It would trigger alerts for any delete operation on any resource, including non-resource-group deletes and those initiated by rg-cleaner@contoso.com.
The Heartbeat table contains agent health data, not resource group deletion events. The query checks if the automation account computer exists, not if a resource group was deleted.
SecurityEvent tracks Windows security events (like process creation), not Azure resource deletions. The question requires monitoring Azure subscription activity logs for resource group deletions, which SecurityEvent does not capture.