turbot/azure_insights

Query: compute_virtual_machine_disaster_recovery_status

Usage

powerpipe query azure_insights.query.compute_virtual_machine_disaster_recovery_status

SQL

with vm_dr_enabled as (
select
substr(source_id, 0, length(source_id)) as source_id
from
azure_resource_link as l
left join azure_compute_virtual_machine as vm on lower(substr(source_id, 0, length(source_id)))= lower(vm.id)
where
l.name like 'ASR-Protect-%'
)
select
'Disaster Recovery' as label,
case when source_id is null then 'Disabled' else 'Enabled' end as value,
case when source_id is null then 'alert' else 'ok' end as type
from
azure_compute_virtual_machine as vm
left join vm_dr_enabled as l on lower(vm.id) = lower(l.source_id)
where
lower(id) = $1
and subscription_id = split_part($1, '/', 3);

Dashboards

The query is used in the dashboards: