turbot/azure_compliance

Query: sql_database_allow_internet_access

Usage

powerpipe query azure_compliance.query.sql_database_allow_internet_access

SQL

select
s.id resource,
case
when firewall_rules @> '[{"properties":{"endIpAddress":"0.0.0.0","startIpAddress":"0.0.0.0"}}]'
or firewall_rules @> '[{"properties":{"endIpAddress":"255.255.255.255","startIpAddress":"0.0.0.0"}}]' then 'alarm'
else 'ok'
end as status,
case
when firewall_rules @> '[{"properties":{"endIpAddress":"0.0.0.0","startIpAddress":"0.0.0.0"}}]'
or firewall_rules @> '[{"properties":{"endIpAddress":"255.255.255.255","startIpAddress":"0.0.0.0"}}]' then s.title || ' allows ingress 0.0.0.0/0 or any ip over internet.'
else s.title || ' not allows ingress 0.0.0.0/0 or any ip over internet.'
end as reason,
s.resource_group as resource_group,
sub.display_name as subscription
from
azure_sql_server s,
azure_subscription sub
where
sub.subscription_id = s.subscription_id;

Controls

The query is being used by the following controls: