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
LowAddress
Operational Maturity, SecurityCompliance 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
Remediation
Using Console
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:
- Login to the Azure portal (https://portal.azure.com/).
- Navigate to the Storage account that is being used to store the logs.
- Click on the “Containers” option under the “Blob service” section in the left-hand menu.
- Select the container that contains the logs.
- Click on the “Encryption” option in the left-hand menu.
- Select the “Customer-managed key” option.
- Select the key that you want to use for encryption from the dropdown list.
- Click on the “Save” button to apply the changes.
Using CLI
Using CLI
To remediate this misconfiguration in AZURE using AZURE CLI, follow the below steps:
-
Open the AZURE CLI and login to your AZURE account using the command:
az login -
Once you have successfully logged in, set the subscription that contains the storage account container using the command:
az account set --subscription <subscription_id> -
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 -
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 -
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 -
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. -
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.encryptionReplace<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.
Using Python
Using Python
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:With these steps, you can remediate the misconfiguration in Azure by encrypting the Storage Account container containing the logs with BYOK.
- 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:
- Once you have created the key vault, you can create a new encryption key in the key vault using the following code:
- Next, you need to enable encryption for the Storage Account container containing the logs. You can use the following code to enable encryption:
- Finally, you need to verify that the encryption is enabled for the Storage Account container. You can use the following code to verify:
Using Terraform
Using Terraform
LOGS_STORAGE_ACCOUNT_NAME,LOGS_STORAGE_ACCOUNT_RG_NAME,LOGS_STORAGE_ACCOUNT_LOCATIONwith 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, andKEY_NAME_FOR_LOGS_ENCRYPTIONwith your actual values.
terraform plan should show:- an in-place update to
azurerm_storage_account.LOGS_STORAGE_ACCOUNTaddingidentityandcustomer_managed_key. - creation of
azurerm_key_vault.LOGS_KV,azurerm_key_vault_key.LOGS_CMK, andazurerm_key_vault_access_policy.STORAGE_TO_KV(if they are not already managed).

