← Sentinel query library

Cloud control plane · Microsoft Sentinel

Investigate additions and removals of Azure resource locks

Review successful lock mutations and identify the protected scope before assessing subsequent management changes or recovery risk.

Before you run

Data & scope

Required tables
AzureActivity
Time window
24 hours
  • Azure Activity export from the relevant subscriptions to AzureActivity in this workspace.
  • Query access and at least 24 hours of retained Administrative activity; portal Activity Log alone does not populate this table.

Documentation review by Codex (AI). No live-tenant execution or detection-performance claim. Validate schema, data coverage and expected results in your workspace.

Kusto Query Language
Download .kql
// Hunting starter. Documentation checked 2026-11-13; not tenant-tested.
AzureActivity
| where TimeGenerated >= ago(1d) and TimeGenerated <= now()
| where CategoryValue =~ "Administrative"
| where OperationNameValue in~ (
    "Microsoft.Authorization/locks/write",
    "Microsoft.Authorization/locks/delete")
| where ActivityStatusValue =~ "Succeeded"
| extend LockAction = iff(OperationNameValue endswith "/delete",
    "Lock removed", "Lock created or updated")
| project TimeGenerated, LockAction, SubscriptionId, ResourceGroup,
    LockResourceId = coalesce(_ResourceId, ResourceId),
    Caller, CallerIpAddress, OperationNameValue,
    ActivityStatusValue, EventDataId, OperationId, CorrelationId
| order by TimeGenerated desc
| take 200

Read-only query. Run in your own authorized workspace after checking prerequisites.

Use this recipe when a protected AI dependency changed unexpectedly or when reviewing temporary lock removal during maintenance. It returns successful creation, update and deletion events for resource locks. A write is labelled “created or updated” because the management action alone does not distinguish those cases.

Understand the protected boundary

Azure resource locks operate on the management plane, with effects determined by the lock type and scope. They do not replace data-plane authorization. A lock on a storage account is not proof that individual blobs cannot be deleted through the service endpoint, and a lock on a vault does not establish that its secrets are protected from authorized data operations. Resource lock behavior.

The returned resource identifier identifies the lock object or scope recorded in the event. Resolve it to the actual protected resource, resource group or subscription. Examine inherited locks as well as the local object. Removal of one lock may leave another effective; conversely, removal of an ancestor lock can expose several dependent resources.

Reconstruct the maintenance sequence

Identify who requested the removal, which task required it and when protection was expected to return. Compare the caller with the approved deployment identity. Then inspect management activity against the protected scope before and after the lock event. Correlation by time alone is not proof that a subsequent deletion used the newly available authority.

For a high-value retrieval store or audit archive, confirm the actual surviving resources and recovery configuration. Preserve the lock definition, change request and relevant activity records before remediation. Recreating a lock does not reverse a deletion that already completed.

The operation strings are drawn from the authorization provider reference. This is a change inventory, not a complete calculation of effective permissions or lock inheritance.

Tune and validate

Expected platform upgrades, environment retirement and disaster-recovery exercises can require controlled lock changes. Prefer an exception for a specific scope, maintenance interval and accountable identity. Do not permanently exempt an automation principal merely because it has performed earlier approved removals.

Validate using historical create, update and delete records from a noncritical environment. Confirm the current lock state independently and ensure a failed removal does not enter this success-only view. The query returns at most 200 event rows from 24 hours; duplicate delivery can create repeated evidence. It is documentation-checked and has not been executed in a tenant. No destructive test or lock removal is required to run the hunt.

Verify the source

Microsoft references

  1. Microsoft Learn — AzureActivity table ↗
  2. Microsoft Learn — Management and governance permissions ↗
  3. Microsoft Learn — Resource lock behavior ↗
Before turning a hunt into an alert

Measure normal activity, validate known test cases, account for ingestion delays, choose a threshold and entity mapping, and assign an owner. Results require investigation.

Follow the detection learning path →