turbot/steampipe-mod-terraform-azure-compliance

Control: Ensure 'Trusted Microsoft Services' is enabled for Storage Account access

Description

Some Microsoft services that interact with storage accounts operate from networks that can't be granted access through network rules. To help this type of service work as intended, allow the set of trusted Microsoft services to bypass the network rules. These services will then use strong authentication to access the storage account. If the Allow trusted Microsoft services exception is enabled, the following services: Azure Backup, Azure Site Recovery, Azure DevTest Labs, Azure Event Grid, Azure Event Hubs, Azure Networking, Azure Monitor and Azure SQL Data Warehouse (when registered in the subscription), are granted access to the storage account.

Usage

Run the control in your terminal:

powerpipe control run terraform_azure_compliance.control.storage_account_trusted_microsoft_services_enabled

Snapshot and share results via Turbot Pipes:

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

SQL

This control uses a named query:

with storage_account_network_rules as (
select
name,
address,
type,
path,
start_line,
split_part((attributes_std ->> 'storage_account_name'), '.',2) as storage_account_name
from
terraform_resource
where
type = 'azurerm_storage_account_network_rules'
and (attributes_std ->> 'bypass') like '%AzureServices%'
), storage_account_name as (
select
name,
address,
type,
path,
_ctx,
start_line
from
terraform_resource
where
type = 'azurerm_storage_account'
)
select
san.type || ' ' || san.name as resource,
case
when sanr.name is null then 'alarm'
else 'ok'
end status,
split_part(san.address, '.', 2) || case
when sanr.name is null then ' trusted Microsoft services not enabled'
else ' trusted Microsoft services enabled'
end || '.' reason
, san.path || ':' || san.start_line
from
storage_account_name as san
left join storage_account_network_rules as sanr on sanr.storage_account_name = san.name;

Tags