turbot/azure_insights

Query: servicebus_namespaces_for_key_vault_key

Usage

powerpipe query azure_insights.query.servicebus_namespaces_for_key_vault_key

SQL

select
lower(n.id) as servicebus_namespace_id
from
azure_servicebus_namespace as n,
jsonb_array_elements(encryption -> 'keyVaultProperties') as p
left join azure_key_vault_key as k on p ->> 'keyName' = k.name
left join azure_key_vault as v on v.name = k.vault_name
where
n.id is not null
and lower(k.resource_group) = lower(v.resource_group)
and lower(k.resource_group) = lower(n.resource_group)
and lower(k.id) = $1
and k.subscription_id = split_part($1, '/', 3);