Control: Storage accounts should use customer-managed key for encryption
Description
Secure your storage account with greater flexibility using customer-managed keys. When you specify a customer-managed key, that key is used to protect and control access to the key that encrypts your data. Using customer-managed keys provides additional capabilities to control rotation of the key encryption key or cryptographically erase data.
Usage
Run the control in your terminal:
powerpipe control run terraform_azure_compliance.control.storage_account_encryption_at_rest_using_cmkSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run terraform_azure_compliance.control.storage_account_encryption_at_rest_using_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_account_customer_managed_key') 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_account_customer_managed_key') then ' encrypted with CMK'    else ' not encrypted with CMK'  end || '.' reason    , path || ':' || start_linefrom  terraform_resourcewhere  type = 'azurerm_storage_account';