Before you run
Data & scope
- Required tables
- 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.
// Hunting starter. Documentation checked 2026-11-13; not tenant-tested.
AzureActivity
| where TimeGenerated >= ago(1d) and TimeGenerated <= now()
| where CategoryValue =~ "Administrative"
| where OperationNameValue endswith "/diagnosticSettings/write"
or OperationNameValue endswith "/diagnosticSettings/delete"
| extend Outcome = case(ActivityStatusValue =~ "Succeeded", "Recorded success",
ActivityStatusValue =~ "Failed", "Recorded failure", "Other lifecycle state")
| project TimeGenerated, Outcome, OperationNameValue,
ActivityStatusValue, ActivitySubstatusValue,
SubscriptionId, ResourceGroup, ResourceId = coalesce(_ResourceId, ResourceId),
Caller, CallerIpAddress, EventDataId, OperationId, CorrelationId
| order by TimeGenerated desc
| take 200
Read-only query. Run in your own authorized workspace after checking prerequisites.
A logging change can remove the evidence needed to investigate the next action. This query inventories diagnostic-setting writes and deletions, including failures and intermediate lifecycle states. It uses operation suffixes so provider-qualified diagnostic-setting actions can be reviewed alongside the common Microsoft.Insights form. Microsoft’s monitoring permissions reference documents those management actions.
Determine whether collection actually changed
Do not interpret every write as disabled logging. A write can add a destination, update a category selection, correct a configuration or repeat an unchanged deployment. A deletion can remove a redundant setting while another still covers the resource. Conversely, a successful write that redirects output may matter more than a failed delete.
Retrieve the setting’s authoritative configuration and its approved previous version. Compare enabled log categories or category groups, destination identifiers, destination access and the resource to which the setting applies. Follow the full route into the intended workspace or archive rather than stopping at a successful management response. Diagnostic-setting model.
The query retains ActivityStatusValue and substatus. “Other lifecycle state” includes submissions and progress records that do not establish completion. Link records with operation and correlation identifiers, then check the final observed state. A missing completion row can also reflect delayed or incomplete collection.
Investigate an apparent visibility gap
Start with the known workload and its expected event rate. Generate a harmless authorized action only if appropriate, then trace whether it appears at each configured destination. Compare timing with a deployment, category migration, destination policy change or service outage. A quiet source and a broken route can produce the same empty query result.
Preserve earlier setting definitions, relevant management records and the last known good ingestion time. Assess which investigations now have incomplete coverage and document the interval explicitly. Restoring a setting does not recreate events that were never collected.
Tuning and validation
Infrastructure redeployment and resource onboarding are frequent benign causes. An exception should identify the specific automation, resource scope and expected configuration change; avoid suppressing all monitoring changes by a platform service principal.
Validate a known successful update and a failed change, confirming that the output labels differ. Check at least one provider-qualified operation from your own environment before using the suffix match operationally. The 24-hour scan returns up to 200 event rows, and no empty result proves complete collection. This hunt was checked against documentation, not executed against a tenant.
Verify the source
Microsoft references
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 →