Skip to main content
Five Steps for Cloud Compliance Readiness·A practical playbook for security teamsDownload
CIS Microsoft Azure Foundations v6.0.0 · 6.1.1.1

Every subscription should send its activity log to a diagnostic setting

  • Level 1
  • Management and Governance Services

This check looks at each Azure subscription for a diagnostic setting that exports the subscription activity log. The safe setting is to have one, so management events are kept somewhere you control beyond the default 90 days.

Why it matters

The Azure activity log records management operations such as creating a virtual machine or changing a key vault access policy. Azure Monitor collects it by default, but it keeps those events for only 90 days and then deletes them. Microsoft also notes that one of the most common reasons to extend retention is that the activity log is the only place that stores who created a resource.

Without a diagnostic setting, an investigation that starts after three months has nothing to read, and you cannot query the events next to your other logs or alert on them in a workspace. A diagnostic setting sends a copy to a Log Analytics workspace, a storage account or an event hub that you choose. Source: Activity log in Azure Monitor (Microsoft Learn).

How to check it yourself

Portal: go to Monitor > Activity log > Export Activity Logs with the subscription selected. A configured setting is listed there with its destination and the categories it sends.

Azure CLI (read-only; it lists settings and changes nothing):

az monitor diagnostic-settings subscription list --subscription <subscription-id>

An empty list means no diagnostic setting exists for that subscription. If you have several, loop over az account list --query "[].id" -o tsv and run the same command for each.

How to fix it

Portal: in Monitor > Activity log > Export Activity Logs choose Add diagnostic setting, tick the categories you want, pick a destination and save.

Azure CLI, which changes the tenant, so run it yourself after choosing a destination (ConfigCobra only reports and suggests, it never changes your tenant):

az monitor diagnostic-settings subscription create \
  --name activity-log-export \
  --subscription <subscription-id> \
  --workspace <log-analytics-workspace-resource-id> \
  --logs '[{"category":"Administrative","enabled":true},{"category":"Security","enabled":true},{"category":"Policy","enabled":true}]'

Then run the check command again and confirm the setting is listed. Choose the categories to match what you need to investigate; selecting all of them captures the most.

What changes when you fix it

Nothing changes for users or running workloads. The activity log is copied to your destination in addition to the built-in 90-day store.

  • Cost owners: Microsoft states there are no ingestion charges for activity logs in a Log Analytics workspace, and retention charges apply only for time beyond the default 90 days. Storage accounts and event hubs have their own pricing.
  • Security and operations teams gain a queryable history and can build alerts on it.
  • Workspace owners should decide access to the workspace, since the log shows who did what.

If a management group already exports events, keep the subscription-level setting too: Microsoft notes some subscription events do not reach management group settings, and that overlapping settings to one destination create duplicate events.

Included in

BenchmarkCIS IDProfile
CIS Microsoft Azure Foundations v6.0.06.1.1.1Level 1

Check this on your Microsoft Azure

ConfigCobra runs this check with every other control of the CIS Microsoft Azure Benchmarks, read-only.

Get in touch

Let's talk.

Whether you're evaluating ConfigCobra, running an audit, or managing a client fleet — we respond within one business day.

Free trial