turbot/azure_compliance

Query: container_registry_geo_replication_enabled

Usage

powerpipe query azure_compliance.query.container_registry_geo_replication_enabled

SQL

with geo_replication_count as (
select
name as name,
subscription_id,
(v ->> 'currentValue')::int as geo_replication_count
from
azure_container_registry,
jsonb_array_elements(usages -> 'value') as v
where
v ->> 'name' = 'Geo-replications'
and v ->> 'unit' = 'Count'
)
select
distinct a.name as resource,
case
when sku_name <> 'Premium' then 'skip'
when c.geo_replication_count > 1 then 'ok'
else 'alarm'
end as status,
case
when sku_name <> 'Premium' then a.name || ' is of ' || sku_tier || ' tier.'
when c.geo_replication_count > 1 then a.name || ' ' || c.geo_replication_count || ' geo replication configured.'
else a.name || ' geo replication not configured.'
end as reason
, a.resource_group as resource_group
, sub.display_name as subscription
from
azure_container_registry as a
left join geo_replication_count as c on a.name = c.name and a.subscription_id = c.subscription_id,
azure_subscription as sub
where
sub.subscription_id = a.subscription_id;

Controls

The query is being used by the following controls: