The storage account that holds activity logs should use a customer-managed encryption key
This check looks at the storage account that receives the subscription activity log and which key protects it. The safe setting is encryption with a customer-managed key kept in Azure Key Vault, instead of the default Microsoft-managed key.
Why it matters
The activity log records management operations such as creating a virtual machine or changing a key vault access policy. Azure keeps these entries for 90 days by default, so teams that need a longer record export them through a diagnostic setting, often to a storage account. That account then holds your change history.
Azure Storage always encrypts data. By default Microsoft manages the key. With a customer-managed key, the key lives in your own Azure Key Vault or Managed HSM and you decide who can use it and when it rotates. You can also cut access to the data by disabling the key. For a log archive that may be used in an investigation, that control over the key is the point of this check.
Sources: Activity log in Azure Monitor and Customer-managed keys for account encryption on Microsoft Learn.
How to check it yourself
In the Azure portal open Monitor > Activity log > Export Activity Logs to see which diagnostic settings send logs to a storage account. Then open that storage account and go to Security + networking > Encryption and look at the encryption type.
Read-only Azure CLI commands:
az monitor diagnostic-settings subscription list --subscription <subscription-id> --query "value[].{name:name, storage:storageAccountId}"
az storage account show --name <account> --resource-group <rg> --query "encryption.{keySource:keySource, keyVault:keyVaultProperties.keyVaultUri}"A key source of Microsoft.Keyvault means a customer-managed key is in use; Microsoft.Storage means the Microsoft-managed key.
How to fix it
Prepare the key vault first. Microsoft requires soft delete and purge protection to be on, and the key must be an RSA or RSA-HSM key. Create a key, give the storage account's managed identity permission to wrap and unwrap with it (for example the built-in role Key Vault Crypto Service Encryption User), then switch the account to that key in the portal under Encryption.
az storage account update --name <account> --resource-group <rg> --assign-identity
# grant the identity access to the key, then:
az storage account update --name <account> --resource-group <rg> \
--encryption-key-source Microsoft.Keyvault \
--encryption-key-vault <vault-uri> --encryption-key-name <key-name>Test on a non-production account first. ConfigCobra itself never changes your Azure; these steps are yours to run.
What changes when you fix it
The data stays encrypted throughout and protection takes effect immediately, so there is no migration of the logs. What changes is a new dependency: the storage account now relies on your key vault. If the key is disabled, deleted or the identity loses access, reads and writes to the account fail with a 403 error for all users, including the tools that read your archived logs. The key vault also adds its own cost, and the key needs a rotation routine. Microsoft notes that Azure Storage checks for a new key version once a day when the version is left automatic, so wait a day before disabling an old version. You can switch back to the Microsoft-managed key at any time.
Owners of the vault, the storage account and any log-reading tools are the people affected.
Included in
| Benchmark | CIS ID | Profile |
|---|---|---|
| CIS Microsoft Azure Foundations v6.0.0 | 6.1.1.3 | Level 2 |
More checks in Management and Governance Services
- Ensure that a 'Diagnostic Setting' Exists for Subscription Activity LogsCIS 6.1.1.1
- Ensure Diagnostic Setting Captures Appropriate CategoriesCIS 6.1.1.2
- Ensure that Logging for Azure Key Vault is 'Enabled'CIS 6.1.1.4
- Ensure that Virtual Network Flow Logs are Captured and Sent to Log AnalyticsCIS 6.1.1.6
Go further
Check this on your Microsoft Azure
ConfigCobra runs this check with every other control of the CIS Microsoft Azure Benchmarks, read-only.