Forum Discussion
KevinHemelrijk
Oct 19, 2023Copper Contributor
KQL query to detect the disablement and deletion of Automation Rules
Hi Community, We want to create a KQL-query that detects whether an automation rule has been disabled. The only way to partially do that at the moment is the AzureActivity table. The problem with...
LeonPavesic
Oct 19, 2023Silver Contributor
Hi KevinHemelrijk,
you can use the following KQL query:
AzureActivity
| where OperationName == "MICROSOFT SECURITYINSIGHTS/AUTOMATIONRULES/WRITE"
| where Category == "Write"
| where Action == "Microsoft.Automation/automationRules/disable"
| project ActivityId, OperationName, Category, Action, ResourceId
This query will return all Azure Activity logs where an Automation Rule has been disabled in Azure Security Insights.
You can combine this query with the one to detect the deletion of Automation Rules to create a single query that will detect both the disablement and deletion of Automation Rules in Azure Security Insights.
(AzureActivity
| where OperationName == "MICROSOFT SECURITYINSIGHTS/AUTOMATIONRULES/WRITE"
| where Category == "Write"
| where Action == "Microsoft.Automation/automationRules/disable"
| project ActivityId, OperationName, Category, Action, ResourceId)
UNION
(AzureActivity
| where OperationName == "MICROSOFT SECURITYINSIGHTS/AUTOMATIONRULES/DELETE"
| where Category == "Delete"
| project ActivityId, OperationName, Category, Action, ResourceId)
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
KevinHemelrijk
Oct 19, 2023Copper Contributor
Hi LeonPavesic ,
Unfortunatelly the AzureActivity Table does not contain the OperationName and Action table, so this does not work.
Unfortunatelly the AzureActivity Table does not contain the OperationName and Action table, so this does not work.
- Clive_WatsonOct 19, 2023Bronze ContributorThat is the legacy Column name, which is now deprecated - its a shame as that did provide the data, before we migrated away.
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log?tabs=powershell#data-structure-changes
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log?tabs=powershell#legacy-collection-methods- KevinHemelrijkOct 24, 2023Copper ContributorHi Clive_Watson ,
thanks for letting us know, it is indeed a shame that Microsoft makes something deprecated and at the same time making it worse. I hope they will release an updated table in the future.