turbot/azure_compliance

Query: compute_vm_disaster_recovery_enabled

Usage

powerpipe query azure_compliance.query.compute_vm_disaster_recovery_enabled

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
vm.vm_id as resource,
case
when l.source_id is null then 'alarm'
else 'ok'
end as status,
case
when l.source_id is null then vm.title || ' disaster recovery disabled.'
else vm.title || ' disaster recovery enabled.'
end as reason
, vm.resource_group as resource_group
, sub.display_name as subscription
from
azure_compute_virtual_machine as vm
left join vm_dr_enabled as l on lower(vm.id) = lower(l.source_id),
azure_subscription sub
where
sub.subscription_id = vm.subscription_id;

Controls

The query is being used by the following controls: