Infrastructure

Azure Monitor: validate category groups before scaling Diagnostic Settings

A production runbook for moving from static log categories to audit or allLogs, measuring ingestion, canarying Azure Policy and rolling back without losing evidence.

05 Nov 2026 azureazure-monitordiagnostic-settingslog-analyticsazure-policyobservabilitykqlautomationguardrailsrunbookrollbackproduction

An Azure platform still collects resource logs through an explicit category list in every Diagnostic Setting. The platform standard must now use a category group, audit for control evidence or allLogs for full coverage, and deploy it across subscriptions with Azure Policy.

The change looks editorial: replace several category names with one group. It changes the observability contract. Microsoft can update the membership of a group, a newly included category can increase ingestion without an IaC change, and a quiet resource can make a successful deployment look like working collection before any event reaches the destination.

The running case covers production Key Vaults sending logs to Log Analytics. The method applies to resource types that expose category groups. The runbook ends with one of four decisions: promote audit, accept allLogs, temporarily retain explicit categories, or roll back the rollout.

Freeze the collection contract

Start with what operators must be able to prove, not with the broadest group. Audit evidence, performance diagnosis and incident reconstruction do not necessarily require the same data.

yaml 01-collection-contract.yml
change: CHG-2026-1105-07
resource_type: Microsoft.KeyVault/vaults
canary_resource: kv-orders-preprod
current_mode: explicit-categories
candidate_mode: audit
destination: law-platform-sec

required_evidence:
- data-plane access attempts
- caller identity and result
- correlation with an approved canary

non_goals:
- enabling service-side auditing features
- exporting platform metrics
- changing workspace retention

gates:
- available group inventoried
- positive and negative canaries visible
- ingestion delay bounded
- volume and cost envelope accepted
- rollback tested

The audit group collects categories that the service classifies as audit. It does not enable a service-specific auditing feature. allLogs covers every available category, but it does not guarantee that the service will emit an event, that the destination is reachable, or that retention meets the operational requirement.

Inventory effective settings and available groups

Export the before state for every canary resource. Preserve the setting name, categories, category groups, Log Analytics destination mode and the workspace, Storage or Event Hub identifiers.

bash 02-inventory-diagnostic-settings.sh
set -eu

RESOURCE_ID="<key-vault-resource-id>"
SETTING="setByPlatform-LogAnalytics"

az monitor diagnostic-settings categories list --resource "$RESOURCE_ID" --output json > categories-available-before.json

az monitor diagnostic-settings list --resource "$RESOURCE_ID" --output json > diagnostic-settings-before.json

az monitor diagnostic-settings show --resource "$RESOURCE_ID" --name "$SETTING" --output json > diagnostic-setting-canary-before.json

Do not assume every resource type exposes the same groups. The inventory must show categoryGroups for the tested type and region. Also verify that an existing policy does not already manage a setting under another name. Two settings exporting the same categories to the same workspace can duplicate records and distort volume, alert and cost decisions.

Measure the risk before choosing audit or allLogs

The useful difference is not only today’s category count. A group is dynamic: its membership can change when a service adds or reclassifies categories. That property reduces coverage drift, but it also turns a platform evolution into an ingestion change.

Build a matrix for each resource type. For every currently available category, name its use case, target table, alert owner and data sensitivity. Estimate volume over a representative period that includes a deployment, a rotation, a traffic peak and a simulated incident.

text 03-category-group-decision.txt
SIGNAL                         AUDIT   ALLLOGS   DECISION
Allowed/denied data access     yes     yes       required
Configuration change          yes*    yes       verify service classification
Performance logs              no*     yes       only with an operational use
Newly added category          varies  yes       volume and schema gate
AllMetrics                    no      no        separate decision

* Confirm with the list returned by the canary resource.

PROMOTE AUDIT
Required security evidence is present
Negative canaries are visible
No runbook depends on an out-of-group category

PROMOTE ALLLOGS
Every category has a use or an evaluation period
Maximum volume and destination capacity are accepted
Queries and alerts tolerate new categories

Do not estimate cost by multiplying the number of categories. Some categories are almost silent while others follow request volume. Measure billable bytes or ingested volume per table on the canary, then add headroom for new categories and peak periods.

Canary without disturbing existing alerts

Deploy the group to one representative resource. The clearest path is a temporary setting that sends to a separate canary workspace. That prevents duplicate events from entering production alerts. If a separate destination is impossible, mark the duplicate window precisely and exclude it from capacity decisions.

bash 04-create-canary-diagnostic-setting.sh
set -eu

RESOURCE_ID="<key-vault-resource-id>"
WORKSPACE_ID="<canary-workspace-resource-id>"
SETTING="canary-audit-category-group"

az monitor diagnostic-settings create --name "$SETTING" --resource "$RESOURCE_ID" --workspace "$WORKSPACE_ID" --logs '[{"categoryGroup":"audit","enabled":true}]' --output json > diagnostic-setting-canary-after.json

The canary uses Key Vault only to make the scenario concrete. Reproduce the configuration in your approved IaC after the test. Do not combine allLogs, audit and individual categories in one setting: the contract must remain unambiguous and testable.

Prove ingestion with directed events

A Succeeded deployment only proves that the control plane accepted the setting. Trigger known operations next: one authorized read, one read denied to a canary identity and one planned configuration change if it belongs to the contract. Tie each test to a UTC window, an identity and a change identifier.

For initial discovery in a narrow canary workspace, the following query locates tables receiving rows for the resource. Replace this broad search with the observed resource-specific tables or AzureDiagnostics before using it at production scale.

kusto 05-prove-canary-ingestion.kql
let Start = datetime(2026-11-05T07:00:00Z);
let End = datetime(2026-11-05T08:00:00Z);
let ResourceId = tolower("<key-vault-resource-id>");
union withsource=TableName isfuzzy=true *
| where TimeGenerated between (Start .. End)
| extend ObservedResourceId = tolower(tostring(column_ifexists("_ResourceId", "")))
| where ObservedResourceId == ResourceId
| summarize Rows=count(),
          FirstSeen=min(TimeGenerated),
          LastSeen=max(TimeGenerated)
  by TableName, bin(TimeGenerated, 5m)
| order by TimeGenerated asc

An empty table for a few minutes is not a definitive failure. Diagnostic Settings have propagation and ingestion latency. Wait for the agreed window, confirm that the operation actually produced a log, then inspect the destination, its network path and table mode before changing the group.

The gate must cover content, not just row presence: expected identity, exact resource, operation, result and temporal correlation. Also verify that alert queries keep working if data moves from AzureDiagnostics to a resource-specific table in a separate change.

Roll out through Policy with a bounded scope

An Azure Policy initiative can apply audit or allLogs at scale and follow new categories added to the group. Treat the assignment and remediation like a production deployment: least-privileged managed identity, explicit scope, documented exemptions and a canary batch.

Start with a pre-production resource group, then a low-criticality subscription. After each wave, measure Policy compliance, settings created or changed, arrival delay, volume by resource type and alert health. Stop if remediation replaces a team-owned setting, changes a destination or creates duplicate collection.

Do not combine a workspace migration, a move to resource-specific mode, a retention change and category replacement in one rollout. Each decision changes the available evidence and makes rollback ambiguous.

Decide or roll back

Promote the group only when canary resources expose the expected group, every directed event reaches the intended destination, runbooks retain their signals and volume stays inside the accepted envelope. Choose audit when the contract centers on security interactions and changes. Choose allLogs when the additional categories have an accepted operational use.

Roll back by pausing Policy remediation first, then restoring the captured JSON or IaC. Remove the canary setting only after the previous setting is producing the expected events again. Do not delete tables or already ingested data: retention and incident value are separate decisions.

The closing decision must be explicit: promote audit, promote allLogs, keep explicit categories with a dated debt item, or return to the previous state. Category groups then become an operable observability contract, not a configuration shortcut.