turbot/azure_insights

Query: compute_virtual_machine_by_disaster_recovery_status

Usage

powerpipe query azure_insights.query.compute_virtual_machine_by_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
status,
count(*)
from (
select
source_id,
case when source_id is null then
'disabled'
else
'enabled'
end status
from
azure_compute_virtual_machine as vm
left join vm_dr_enabled as l on lower(vm.id) = lower(l.source_id)) as vm
group by
status
order by
status;

Dashboards

The query is used in the dashboards: