Query Details
# Identify activities in log analytics workspace resource locks # Description The following query which would identify activities related to your log analytics workspace relevant resource group locks. That way if someone decides to either edit or delete your lock, you would be able to detect it. ### Microsoft Sentinel ``` let LAWResourceGroup = @"<your log analytics workspace resource group here>"; // Define Resource Group containing Sentinel's LAW AzureActivity | where ResourceGroup == LAWResourceGroup | where OperationNameValue startswith "MICROSOFT.AUTHORIZATION/LOCKS" | where ActivityStatusValue == "Success" | extend EventSubmissionTimeStamp = tostring(parse_json(Properties).eventSubmissionTimestamp) | extend EventCaller = tostring(parse_json(Properties).caller) | extend EventCallerIPAddress = tostring(parse_json(tostring(parse_json(Properties).httpRequest)).clientIpAddress) | extend EventMessage = tostring(parse_json(Properties).message) | extend LocksAction = extract(@"Microsoft\.Authorization\/locks\/(\w+)", 1, EventMessage) | extend EventRoleDefinitionId = tostring(parse_json(tostring(parse_json(tostring(parse_json(Properties).requestbody)).Properties)).RoleDefinitionId) | project EventSubmissionTimeStamp, EventCaller, EventCallerIPAddress, LocksAction ``` ### Versioning | Version | Date | Comments | | ------------- |---------------| ---------------------------------------| | 1.0 | 30/06/2025 | Initial publish |
This query is designed to monitor and identify activities related to resource locks within a specific Log Analytics Workspace's resource group in Microsoft Sentinel. Here's a simplified breakdown of what the query does:
Define the Resource Group: It starts by specifying the resource group that contains the Log Analytics Workspace (LAW) you want to monitor.
Filter Activities: The query searches through Azure Activity logs for actions related to resource locks within the specified resource group. It specifically looks for operations that start with "MICROSOFT.AUTHORIZATION/LOCKS" and have a status of "Success," indicating successful lock-related actions.
Extract Details: For each relevant activity, the query extracts and formats several pieces of information:
Project Results: Finally, it displays a table with the timestamp, caller, caller IP address, and the action taken on the locks.
This query helps in auditing and detecting any changes made to resource locks, ensuring that unauthorized modifications can be quickly identified and addressed.

Michalis Michalos
Released: June 30, 2025
Tables
Keywords
Operators