Azure Backup: vaults, policies, backup and restore
Soft delete and versioning cover a storage account. For whole machines, file shares and databases, the tool is Azure Backup: copies kept in a vault that the protected resource's own admins can't quietly delete, on a schedule, with retention rules, restorable to a point in time. The sentence to remember from this lesson: a backup you have never restored is a hope, not a backup. The exam asks about vault types and policies. On-call is asked "can you restore it by 9?". This lesson covers both.
Need to know: there are two vault types, and the workload decides which one you use.
| Recovery Services vault | Backup vault | |
|---|---|---|
| CLI | az backup ... | az dataprotection ... |
| Protects | Azure VMs, SQL Server / SAP HANA in VMs, Azure Files, on-premises (MARS agent, MABS/DPM) | Azure Blobs, Azure Disks, Azure Database for PostgreSQL, AKS, Data Lake |
| Also | Site Recovery (next lesson) |
Both are created in a region and protect resources in the same region. Both have soft delete, redundancy settings (LRS, ZRS, GRS) and immutability options.
A Recovery Services vault
$ az group create -n rg-try-bk -l westeurope -o none
$ az vm create -g rg-try-bk -n vm-try-app --image Ubuntu2404 --size Standard_B2s --generate-ssh-keys -o none 2>/dev/null
$ az backup vault create -g rg-try-bk -n rsv-try -l westeurope --query "{name:name, sku:sku.name}" -o table
Name Sku
------- ---
rsv-try RS0
$ az backup vault backup-properties show -g rg-try-bk -n rsv-try --query "[0].properties.{redundancy:storageModelType, softDelete:softDeleteFeatureState, softDeleteDays:softDeleteDuration, crossRegionRestore:crossRegionRestoreFlag}"
{
"crossRegionRestore": false,
"redundancy": "GeoRedundant",
"softDelete": "Enabled",
"softDeleteDays": 14
}
- Storage redundancy defaults to GeoRedundant. It can only be changed before the first item is protected, after that it's locked for the vault's life. Decide it first: LRS for dev, GRS (with Cross Region Restore, so you can restore in the paired region yourself) for production.
- Soft delete: deleted backup data is kept 14 days (configurable 14-180). Turn on always-on soft delete where you can, so nobody can turn it off first and then delete.
$ az backup vault backup-properties set -g rg-try-bk -n rsv-try --backup-storage-redundancy LocallyRedundant --query "[0].properties.storageModelType" -o tsv
LocallyRedundant
Policies
A backup policy = schedule (when) + retention (how long, in daily / weekly / monthly / yearly points) + instant restore (how many days of local snapshots are kept for fast restores).
$ az backup policy list -g rg-try-bk -v rsv-try -o table
Name Type ResourceGroup
-------------- ----------- -------------
DefaultPolicy AzureIaasVM rg-try-bk
EnhancedPolicy AzureIaasVM rg-try-bk
$ az backup policy show -g rg-try-bk -v rsv-try -n DefaultPolicy --query "properties.{type:policyType, runsAt:schedulePolicy.scheduleRunTimes, dailyKeep:retentionPolicy.dailySchedule.retentionDuration.count, instantDays:instantRpRetentionRangeInDays}"
{
"dailyKeep": 30,
"instantDays": 2,
"runsAt": [
"2026-09-22T23:30:00+00:00"
],
"type": "V1"
}
$ az backup policy show -g rg-try-bk -v rsv-try -n EnhancedPolicy --query "properties.{type:policyType, frequency:schedulePolicy.scheduleRunFrequency, dailyKeep:retentionPolicy.dailySchedule.retentionDuration.count}"
{
"dailyKeep": 30,
"frequency": "Daily",
"type": "V2"
}
| Standard policy (V1) | Enhanced policy (V2) | |
|---|---|---|
| Frequency | once a day | every 4-24 hours, or daily/weekly |
| Instant restore snapshots | 1-5 days | 1-30 days |
| Trusted Launch / Premium SSD v2 / Ultra disks | not supported | required |
| Zone-redundant snapshots | no | yes |
Your own policy is the default's JSON, edited: az backup policy show ... > p.json, change the schedule or retention, az backup policy create -n daily-35d --policy @p.json. Retention is enforced: the daily count is between 7 and 9999.
Protecting a VM
$ az vm show -g rg-try-bk -n vm-try-app --query securityProfile.securityType -o tsv
TrustedLaunch
$ az backup protection enable-for-vm -g rg-try-bk -v rsv-try --vm vm-try-app --policy-name DefaultPolicy -o none
ERROR: (UserErrorStandardPolicyNotSupportedWithTrustedLaunchVM) (simulator) vm-try-app is a Trusted Launch VM: protect it with an Enhanced policy (EnhancedPolicy, or one of yours with policyType V2).
Code: UserErrorStandardPolicyNotSupportedWithTrustedLaunchVM
Message: (simulator) vm-try-app is a Trusted Launch VM: protect it with an Enhanced policy (EnhancedPolicy, or one of yours with policyType V2).
$ az backup protection enable-for-vm -g rg-try-bk -v rsv-try --vm vm-try-app --policy-name EnhancedPolicy --query "properties.{operation:operation, status:status}"
{
"operation": "ConfigureBackup",
"status": "Completed"
}
$ az backup item list -g rg-try-bk -v rsv-try --query "[].{vm:properties.friendlyName, policy:properties.policyName, status:properties.protectionStatus, last:properties.lastBackupStatus}" -o table
Vm Policy Status Last
---------- -------------- ------- ----
vm-try-app EnhancedPolicy Healthy
Nothing has been backed up yet: the first backup runs at the policy's time tonight. Before a risky change, take an on-demand backup and keep it until a date:
$ az backup protection backup-now -g rg-try-bk -v rsv-try -c vm-try-app -i vm-try-app --backup-management-type AzureIaasVM --retain-until 22-10-2026 --query "properties.{operation:operation, status:status}"
{
"operation": "Backup",
"status": "InProgress"
}
$ az backup job list -g rg-try-bk -v rsv-try --query "[].{operation:properties.operation, status:properties.status, item:properties.entityFriendlyName}" -o table
Operation Status Item
--------------- ---------- ----------
Backup InProgress vm-try-app
ConfigureBackup Completed vm-try-app
A VM backup is two phases: take snapshot (minutes; this is the instant recovery point you can restore from quickly) and transfer data to vault (longer; the vault-standard point that survives the VM and its disks). Jobs run on Azure's clock, not yours: az backup job wait or check back.
Recovery points and restores
$ az backup job wait -g rg-try-bk -v rsv-try -n $(az backup job list -g rg-try-bk -v rsv-try --operation Backup --query "[0].name" -o tsv) --query properties.status -o tsv
Completed
$ az backup recoverypoint list -g rg-try-bk -v rsv-try -c vm-try-app -i vm-try-app --backup-management-type AzureIaasVM -o table
Name Time Consistency
----------- ------------------------- --------------------
17901077267 2026-09-22T20:01:26+00:00 FileSystemConsistent
$ az backup recoverypoint list -g rg-try-bk -v rsv-try -c vm-try-app -i vm-try-app --backup-management-type AzureIaasVM --query "[0].properties.recoveryPointTierDetails[].type" -o tsv
InstantRP
HardenedRP
The restore options for a VM:
| Option | What you get | When |
|---|---|---|
| Create a new VM | a VM from the point, in a target RG/VNet | the VM is gone, or you want a copy side by side |
| Restore disks | managed disks + an ARM template in a staging storage account | you want to adjust the VM before creating it, or attach disks elsewhere |
| Replace existing | the VM's disks swapped for the point's (a snapshot of the current ones is kept) | roll the same VM back |
| File recovery | a script that mounts the point's volumes on a machine | you need one file, not the VM |
| Cross Region Restore | any of the above in the paired region (GRS vault, CRR on) | the primary region is down |
$ az storage account create -n sttrybkstage01 -g rg-try-bk -o none
$ az group create -n rg-try-bk-restore -l westeurope -o none
$ RP=$(az backup recoverypoint list -g rg-try-bk -v rsv-try -c vm-try-app -i vm-try-app --backup-management-type AzureIaasVM --query "[0].name" -o tsv)
$ az backup restore restore-disks -g rg-try-bk -v rsv-try -c vm-try-app -i vm-try-app -r $RP --storage-account sttrybkstage01 --target-resource-group rg-try-bk-restore --query "properties.{operation:operation, status:status}"
{
"operation": "Restore",
"status": "InProgress"
}
The staging account must be in the vault's region and be a Standard LRS/GRS account (not ZRS, not Premium). A restore job's failure is often just that. When the job completes, the disks are in the target group and the template to build the VM is in the staging account (the job's extendedInfo names both).
Backup vaults: blobs and disks
Operational backup for blobs keeps the data in the source account (it uses soft delete, versioning and point-in-time restore under the hood: fast restores, but the same account). Vaulted backup copies blobs into the Backup vault, which survives the account being deleted. The vault's managed identity needs a role on what it protects: Storage Account Backup Contributor on the account, Disk Backup Reader on a disk.
$ az dataprotection backup-vault create -g rg-try-bk --vault-name bv-try -l westeurope --storage-setting datastore-type=VaultStore type=LocallyRedundant --query "{name:name, identity:identity.type}"
{
"identity": "SystemAssigned",
"name": "bv-try"
}
$ az dataprotection backup-policy get-default-policy-template --datasource-type AzureBlob > blobpol.json
$ az dataprotection backup-policy create -g rg-try-bk --vault-name bv-try -n blob30d --policy @blobpol.json --query name -o tsv
blob30d
$ az dataprotection backup-instance initialize --datasource-type AzureBlob -l westeurope --policy-id $(az dataprotection backup-vault show -g rg-try-bk --vault-name bv-try --query id -o tsv)/backupPolicies/blob30d --datasource-id $(az storage account show -n sttrybkstage01 -g rg-try-bk --query id -o tsv) > bi.json
$ az dataprotection backup-instance create -g rg-try-bk --vault-name bv-try --backup-instance @bi.json 2>&1 | head -1
ERROR: (UserErrorMissingRequiredPermissions) Appropriate permissions to perform the operation is missing. (simulator) The Backup vault's managed identity (3bd41d79-6c20-401a-9f63-da7792ef51d5) needs the Storage Account Backup Contributor role on sttrybkstage01.
$ az role assignment create --assignee $(az dataprotection backup-vault show -g rg-try-bk --vault-name bv-try --query identity.principalId -o tsv) --role "Storage Account Backup Contributor" --scope $(az storage account show -n sttrybkstage01 -g rg-try-bk --query id -o tsv) -o none
$ az dataprotection backup-instance create -g rg-try-bk --vault-name bv-try --backup-instance @bi.json --query properties.currentProtectionState -o tsv
ProtectionConfigured
Backup at scale
Nobody enables backup VM by VM in a real estate. The Azure Policy built-in Configure backup on virtual machines without a given tag to an existing recovery services vault in the same location (09ce66bc-1220-4153-8104-e3f51c936913, deployIfNotExists) protects every VM in its scope with a given vault and policy, unless the VM carries an exclusion tag. It needs a managed identity with a role, and a remediation task for the VMs that already exist: exactly the pattern from the policy lessons. Azure Backup should be enabled for Virtual Machines (auditIfNotExists) only reports.
On the exam (AZ-104 5.2.1-5.2.4): which vault for which workload, vault storage redundancy (locked after the first item) and Cross Region Restore, Standard vs Enhanced policies (Trusted Launch needs Enhanced, hourly backups), retention, on-demand backups, the restore options and their prerequisites (staging account), file recovery, soft delete (14 days, always-on), Backup vault roles for blobs/disks.
In an interview: "How do you know your backups work?" - "I restore them. A scheduled restore drill (restore disks or a new VM into an isolated group, boot it, check the app or a file, record the time it took against our RTO), backup job failure alerts routed to on-call, and a report of items whose last successful backup is older than the policy allows. Until a restore has worked, I don't count it as a backup."
What you can now do
- Pick the vault type for a workload and set its redundancy before protecting anything.
- Choose and read a backup policy (Standard vs Enhanced), protect a VM and take an on-demand backup.
- List recovery points and restore disks (with the staging account rules), and name the other restore options.
- Protect blobs with a Backup vault and its identity's role, and backups at scale with Azure Policy.