turbot/tailpipe-mod-azure-cost-and-usage-insights

Query: cost_and_usage_actual_cost_by_subscription_dashboard_subscriptions_input

Usage

powerpipe query azure_cost_and_usage_insights.query.cost_and_usage_actual_cost_by_subscription_dashboard_subscriptions_input

SQL

with subscription_ids as (
select
distinct on(subscription_id)
subscription_id ||
case
when subscription_name is not null then ' (' || coalesce(subscription_name, '') || ')'
else ''
end as label,
subscription_id as value
from
azure_cost_and_usage_actual
where
subscription_id is not null and subscription_id != ''
and subscription_name is not null and subscription_name != ''
order by label
)
select
'All' as label,
'all' as value
union all
select
label,
value
from
subscription_ids;