turbot/azure_compliance

Query: sql_server_use_virtual_service_endpoint

Usage

powerpipe query azure_compliance.query.sql_server_use_virtual_service_endpoint

SQL

with sql_server_subnet as (
select
distinct a.name,
rule -> 'properties' -> 'virtualNetworkSubnetId' as subnet_id
from
azure_sql_server as a,
jsonb_array_elements(virtual_network_rules) as rule
)
select
distinct a.name as resource,
case
when s.name is null then 'alarm'
else 'ok'
end as status,
case
when s.name is null then a.name || ' not configured with virtual service endpoint.'
else a.name || ' configured with virtual service endpoint.'
end as reason
, a.resource_group as resource_group
, sub.display_name as subscription
from
azure_sql_server as a
left join sql_server_subnet as s on a.name = s.name,
azure_subscription as sub
where
sub.subscription_id = a.subscription_id;

Controls

The query is being used by the following controls: