turbot/azure_insights

Query: parent_cosmosdb_account_for_cosmosdb_account

Usage

powerpipe query azure_insights.query.parent_cosmosdb_account_for_cosmosdb_account

SQL

with parent_rda as (
select
lower(ra.id) as id,
ra.subscription_id,
ra.account_name
from
azure_cosmosdb_restorable_database_account ra,
azure_cosmosdb_account a
where
ra.id = a.restore_parameters ->> 'restoreSource'
and lower(a.id) = $1
and a.subscription_id = split_part($1, '/', 3)
)
select
lower(a.id) as account_id
from
parent_rda ra,
azure_cosmosdb_account a
where
ra.account_name = a.name
and ra.subscription_id = a.subscription_id;