turbot/azure_insights

Query: activedirectory_directory_roles_for_user

Usage

powerpipe query azure_insights.query.activedirectory_directory_roles_for_user

SQL

select
role_name as "Role Name",
id as "Role ID"
from
(
select
dr.display_name as role_name,
dr.id as id
from
azuread_directory_role as dr,
jsonb_array_elements(member_ids) as m
where
trim((m::text), '""') = split_part($1, '/', 1)
and dr.tenant_id = split_part($1, '/', 2)
union select
dr.display_name as role_name,
dr.id as id
from
azuread_directory_role as dr,
jsonb_array_elements(member_ids) as m
where
trim((m::text), '""') in (select
g.id as id
from
azuread_group as g,
jsonb_array_elements(member_ids) as m
where
trim((m::text), '""') = split_part($1, '/', 1)
and g.tenant_id = split_part($1, '/', 2))
) data
order by
role_name;

Dashboards

The query is used in the dashboards: