Control: Storage account encryption scopes should use customer-managed keys to encrypt data at rest
Description
Use customer-managed keys to manage the encryption at rest of your storage account encryption scopes. Customer-managed keys enable the data to be encrypted with an Azure key-vault key created and owned by you. You have full control and responsibility for the key lifecycle, including rotation and management.
Usage
Run the control in your terminal:
powerpipe control run terraform_azure_compliance.control.storage_account_encryption_scopes_encrypted_at_rest_with_cmkSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_azure_compliance.control.storage_account_encryption_scopes_encrypted_at_rest_with_cmk --shareSQL
This control uses a named query:
select address as resource, case when name in (select split_part((attributes_std ->> 'storage_account_id'), '.', 2) from terraform_resource where type = 'azurerm_storage_encryption_scope' and (attributes_std ->> 'source') = 'Microsoft.KeyVault') then 'ok' else 'alarm' end status, split_part(address, '.', 2) || case when name in (select split_part((attributes_std ->> 'storage_account_id'), '.', 2) from terraform_resource where type = 'azurerm_storage_encryption_scope' and (attributes_std ->> 'source') = 'Microsoft.KeyVault') then ' encrypted with CMK' else ' not encrypted with CMK' end || '.' reason , path || ':' || start_linefrom terraform_resourcewhere type = 'azurerm_storage_account';