turbot/azure_insights

Query: subscriptions_for_activedirectory_user

Usage

powerpipe query azure_insights.query.subscriptions_for_activedirectory_user

SQL

select
distinct d.subscription_id as subscription_id
from
azuread_user as u
left join azure_role_assignment as a on a.principal_id = u.id
left join azure_role_definition as d on d.id = a.role_definition_id
where
a.scope like '/subscriptions/%'
and d.id is not null
and u.id = $1
and u.tenant_id = split_part($1, '/', 2);