vm_backup_status
Checks which Azure VMs are protected by Azure Backup and whether their last backup succeeded, flagging unprotected, failed, or stale backups by subscription.
Instructions
Which Azure VMs are backed up by Azure Backup, and whether the last backup succeeded.
Joins every VM of a subscription (Microsoft.Compute/virtualMachines)
with the Azure-VM protected items of its Recovery Services vaults, on the
VM's ARM id (case-insensitively; ARM casing differs between the two
services). Read-only; needs the Reader role on the subscription.
Per VM:
protected:truewhen a protected item exists withprotectionStateProtectedorIRPending(first backup not done yet,notesays so);falsewhen there is none, or it isProtectionStopped/ProtectionPaused/ProtectionError(data may be retained, backups are not running -- the state is shown);null(unknown) when no item was found but the vault scan was incomplete (capped, a skipped vault, an unreadable or unreached subscription -- in the global join, any subscription's) -- a partial scan never produces a false "unprotected".backup_ok:trueforlastBackupStatusCompleted/CompletedWithWarnings,falseforFailed,nullbefore any backup ran or while one is running (InProgress,Warning, an unknown value). An item whoseprotectionStateis missing isprotected: nullwith a note. When two vaults hold an item for one VM, the one still backing up wins (duplicate_itemscounts them).stale: no recovery point (lastRecoveryPoint, the proof of a successful backup) withinstale_hours. The default 36 h suits daily policies; raise it for weekly ones (policy_nameis in the row).
subscription is an id or display name from list_subscriptions;
None scans every visible subscription and joins globally, so a VM
backed up to a vault in another subscription is matched. With one
subscription named, only its vaults are scanned (coverage says so).
An unknown or ambiguous name returns found: false.
orphans are protected items whose VM no longer exists (backup data
retained for a deleted VM), reported only when that VM's subscription was
listed completely. One subscription's permission error is reported on its
own entry; the others still return. When the wall-clock budget runs out,
the remaining subscriptions are listed under skipped and capped is
set.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_pages | No | ||
| stale_hours | No | ||
| subscription | No |