turbot/steampipe-mod-azure-compliance

Control: Azure Cosmos DB accounts should have firewall rules

Description

Firewall rules should be defined on your Azure Cosmos DB accounts to prevent traffic from unauthorized sources. Accounts that have at least one IP rule defined with the virtual network filter enabled are deemed compliant. Accounts disabling public access are also deemed compliant.

Usage

Run the control in your terminal:

powerpipe control run azure_compliance.control.cosmosdb_account_with_firewall_rules

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run azure_compliance.control.cosmosdb_account_with_firewall_rules --share

SQL

This control uses a named query:

select
a.id as resource,
case
when public_network_access = 'Enabled'
and is_virtual_network_filter_enabled = 'false'
and jsonb_array_length(ip_rules) = 0 then 'alarm'
else 'ok'
end as status,
case
when public_network_access = 'Enabled'
and is_virtual_network_filter_enabled = 'false'
and jsonb_array_length(ip_rules) = 0 then a.name || ' does not have firewall rules.'
else a.name || ' has firewall rules.'
end as reason,
a.resource_group as resource_group,
sub.display_name as subscription
from
azure_cosmosdb_account as a,
azure_subscription as sub
where
sub.subscription_id = a.subscription_id;

Tags