An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
Hi @Pender Sessoms
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
It looks like the query you’re using to capture DCR deletions needs a little tweak. Here’s an updated version that should work for you:
AzureActivity
| where ResourceProvider == "Microsoft.Insights"
| where OperationNameValue == "Microsoft.Insights/dataCollectionRules/delete"
| where ActivityStatusValue == "Succeeded"
| project TimeGenerated, ResourceGroup, Resource, OperationNameValue, ActivityStatusValue, Identity, Caller
-
ResourceProvider == "Microsoft.Insights"filters for actions related to Azure Insights, where DCRs are managed. -
OperationNameValue == "Microsoft.Insights/dataCollectionRules/delete"looks specifically for DCR deletions. -
ActivityStatusValue == "Succeeded"ensures the alert only triggers on successful deletions. -
projectbrings in useful details like who deleted the DCR and which resource was affected.
For this to work, make sure Activity Logs are being captured at the subscription level. If they aren’t enabled, the deletion events won’t show up in your query. Go to Azure Monitor → Activity Logs and make sure you're capturing logs for the entire subscription, including all your VMs.
Now that you have the query set up, follow these steps to create the alert:
- Go to Azure Monitor → Alerts → + New Alert Rule.
- Choose Custom log search and paste the query above.
- Set the alert to trigger if it finds any results (i.e., a DCR has been deleted).
- Set up an Action Group to send you a notification (via email or however you prefer).
Once everything is set up, you can test it by deleting a DCR and checking if you get an alert.
With this updated query and by ensuring your Activity Logs are collecting the right data, you’ll be able to track when a DCR is deleted across all VMs in your subscription. I hope this helps! Feel free to reach out if you need any further clarification or run into any issues.
If you have any further queries, do let us know.