turbot/azure_insights

Query: compute_virtual_machines_for_network_interface

Usage

powerpipe query azure_insights.query.compute_virtual_machines_for_network_interface

SQL

with vm_network_interface_id as (
select
id,
jsonb_array_elements(network_interfaces)->>'id' as n_id
from
azure_compute_virtual_machine
)
select
lower(v.id) as virtual_machine_id
from
vm_network_interface_id as v
left join azure_network_interface as n on lower(v.n_id) = lower(n.id)
where
lower(n.id) = $1
and n.subscription_id = split_part($1, '/', 3);