turbot/azure_insights

Query: compute_virtual_machine_scale_set_logging_status

Usage

powerpipe query azure_insights.query.compute_virtual_machine_scale_set_logging_status

SQL

with logging_details as (
select
distinct a.id as vm_scale_set_id
from
azure_compute_virtual_machine_scale_set as a,
jsonb_array_elements(extensions) as b
where
(b ->> 'Publisher' = 'Microsoft.Azure.Diagnostics'
and b ->> 'ExtensionType' = 'IaaSDiagnostics'
or
(b ->> 'Publisher' = any(ARRAY ['Microsoft.OSTCExtensions', 'Microsoft.Azure.Diagnostics']))
and b ->> 'ExtensionType' = 'LinuxDiagnostic')
)
select
'Logging' as label,
case
when b.vm_scale_set_id is not null
then 'Enabled'
else 'Disabled' end as value,
case
when b.vm_scale_set_id is not null
then 'ok'
else 'alert' end as type
from
azure_compute_virtual_machine_scale_set as a
left join logging_details as b on lower(a.id) = lower(b.vm_scale_set_id)
where
lower(id) = $1
and subscription_id = split_part($1, '/', 3);

Dashboards

The query is used in the dashboards: