Skip to main content

More Info:

Configuring the storage account with the activity log export container to use BYOK (Use Your Own Key) provides additional confidentiality controls on log data as a given user must have read permission on the corresponding storage account and must be granted decrypt permission by the CMK.

Risk Level

Low

Address

Operational Maturity, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AZURE
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • HIPAA
  • ISO 27001
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • Reserve Bank of India (RBI) Cyber Security Framework
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “Ensure Storage Account container containing the logs is encrypted with BYOK” for Azure using the Azure console, follow the below steps:
  1. Login to the Azure portal (https://portal.azure.com/).
  2. Navigate to the Storage account that is being used to store the logs.
  3. Click on the “Containers” option under the “Blob service” section in the left-hand menu.
  4. Select the container that contains the logs.
  5. Click on the “Encryption” option in the left-hand menu.
  6. Select the “Customer-managed key” option.
  7. Select the key that you want to use for encryption from the dropdown list.
  8. Click on the “Save” button to apply the changes.
By following these steps, you will ensure that the Storage Account container containing the logs is encrypted with BYOK in Azure.

To remediate this misconfiguration in AZURE using AZURE CLI, follow the below steps:
  1. Open the AZURE CLI and login to your AZURE account using the command: az login
  2. Once you have successfully logged in, set the subscription that contains the storage account container using the command: az account set --subscription <subscription_id>
  3. Next, get the resource ID of the storage account container using the command: az storage account show -n <storage_account_name> -g <resource_group_name> --query id --output tsv
  4. Now, create a new customer-managed key (CMK) using the command: az keyvault create -n <key_vault_name> -g <resource_group_name> --location <location> --sku standard
  5. Once the key vault is created, get the key identifier using the command: az keyvault key show --vault-name <key_vault_name> -n <key_name> --query key.kid --output tsv
  6. Now, enable encryption for the storage account container using the command: az storage account update -n <storage_account_name> -g <resource_group_name> --encryption-services blob --encryption-key-name <key_name> --encryption-key-vault <key_vault_uri> Replace <key_name> with the name of the key you created in step 4, and <key_vault_uri> with the URI of the key vault you created in step 4.
  7. Finally, verify that the storage account container is encrypted with BYOK using the command: az storage container show -n <container_name> --account-name <storage_account_name> --account-key <storage_account_key> --query properties.encryption Replace <container_name> with the name of the container, <storage_account_name> with the name of the storage account, and <storage_account_key> with the access key for the storage account.
That’s it! You have successfully remediated the misconfiguration by encrypting the storage account container with BYOK in AZURE using AZURE CLI.
To remediate the misconfiguration in Azure, you can use the Azure Python SDK to encrypt the Storage Account container containing the logs with BYOK. Here are the step-by-step instructions:
  1. First, you need to create a new key vault in Azure to store the encryption key. You can use the following code to create a new key vault:
  1. Once you have created the key vault, you can create a new encryption key in the key vault using the following code:
  1. Next, you need to enable encryption for the Storage Account container containing the logs. You can use the following code to enable encryption:
  1. Finally, you need to verify that the encryption is enabled for the Storage Account container. You can use the following code to verify:
With these steps, you can remediate the misconfiguration in Azure by encrypting the Storage Account container containing the logs with BYOK.
Substitute:
  • LOGS_STORAGE_ACCOUNT_NAME, LOGS_STORAGE_ACCOUNT_RG_NAME, LOGS_STORAGE_ACCOUNT_LOCATION with the storage account that is configured as the Azure Monitor log export destination.
  • KEY_VAULT_NAME, KEY_VAULT_RG_NAME, KEY_VAULT_LOCATION, TENANT_ID, and KEY_NAME_FOR_LOGS_ENCRYPTION with your actual values.
This change updates the existing storage account in place (no forced replacement), switching its encryption to use a customer-managed key (BYOK) for the container that holds Azure Monitor logs.For verification, terraform plan should show:
  • an in-place update to azurerm_storage_account.LOGS_STORAGE_ACCOUNT adding identity and customer_managed_key.
  • creation of azurerm_key_vault.LOGS_KV, azurerm_key_vault_key.LOGS_CMK, and azurerm_key_vault_access_policy.STORAGE_TO_KV (if they are not already managed).

Additional Reading: