turbot/steampipe-mod-terraform-azure-compliance

Control: Cognitive Services accounts should enable data encryption with a customer-managed key

Description

Customer-managed keys are commonly required to meet regulatory compliance standards. Customer-managed keys enable the data stored in Cognitive Services 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.cognitive_account_encrypted_with_cmk

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run terraform_azure_compliance.control.cognitive_account_encrypted_with_cmk --share

SQL

This control uses a named query:

with all_cognitive_account as (
select
*
from
terraform_resource
where
type = 'azurerm_cognitive_account'
), cognitive_account_cmk as (
select
*
from
terraform_resource
where
type = 'azurerm_cognitive_account_customer_managed_key'
)
select
c.address as resource,
case
when (b.attributes_std ->> 'cognitive_account_id') is not null then 'ok'
else 'alarm'
end as status,
split_part(c.address, '.', 2) || case
when (b.attributes_std ->> 'cognitive_account_id') is not null then ' encrypted with CMK'
else ' not encrypted with CMK'
end || '.' reason
, c.path || ':' || c.start_line
from
all_cognitive_account as c
left join cognitive_account_cmk as b on c.name = (split_part((b.attributes_std ->> 'cognitive_account_id'), '.', 2))

Tags