turbot/azure_insights

Query: network_security_group_assoc

Usage

powerpipe query azure_insights.query.network_security_group_assoc

SQL

-- NICs
select
ni.title as "Title",
'Network Interface' as "Type",
ni.id as "ID"
from
azure_network_security_group as nsg,
jsonb_array_elements(nsg.network_interfaces) as nic
left join azure_network_interface as ni on lower(ni.id) = lower(nic ->> 'id')
where
lower(nsg.id) = $1
and nsg.subscription_id = split_part($1, '/', 3)
-- Subnets
union select
s.title as "Title",
'Subnet' as "Type",
s.id as "ID"
from
azure_network_security_group as nsg,
jsonb_array_elements(nsg.subnets) as subnets
left join azure_subnet as s on lower(s.id) = lower(subnets ->> 'id')
where
lower(nsg.id) = $1
and nsg.subscription_id = split_part($1, '/', 3)

Dashboards

The query is used in the dashboards: