turbot/azure_insights

Query: compute_virtual_machine_disaster_recovery_disabled_count

Usage

powerpipe query azure_insights.query.compute_virtual_machine_disaster_recovery_disabled_count

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
count(*) as value,
'Disaster Recovery Disabled' as label,
case count(*) when 0 then 'ok' else 'alert' end as type
from
azure_compute_virtual_machine as vm
where lower(vm.id) not in (select source_id from azure_resource_link) ;