Azure Backup for VMs
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Day-to-day operations
-
Phase 3: Enterprise architecture
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
Azure VM backup copies your whole VM, every disk, on a schedule and keeps restore points for days, months or even years. When a disk gets corrupted, ransomware hits, or someone deletes the wrong VM, this is what gets you back.
Azure Backup comes built in, doesn’t need a backup server and works through the VM agent. The hard part is the decisions around it: the vault’s storage type, the policy, soft delete, and testing a restore before the day you need one.
You’ll build a Recovery Services vault, back up web01 and restore it as a new VM. After that you’ll run into two walls that catch admins all the time: a policy you can’t undo, and a vault that refuses to delete.
| Time | You need | Cost | By the end you can |
|---|---|---|---|
| About 90 minutes (the first backup takes 20 to 40 minutes) | web01, the storage account from Lesson 21, the CLI | About 50 US cents if you finish and clean up the same day: a protected-instance fee, snapshot and vault storage, and the restored VM for an hour | Back up VMs, restore them, choose policies and vault settings, and clean up vaults safely |
What it is, in one line
Azure VM backup takes scheduled snapshots of a VM’s disks, keeps them in a vault, and restores the VM or its disks whenever you ask.
In Simple Words
Photocopies of the school register
Every evening the school office photocopies the whole register and files the copy in a fireproof cabinet across the road, so that’s your backup and the cabinet is the vault. The office also keeps the last few days’ copies on its own shelf, which means yesterday’s mistake gets fixed in minutes, while older copies have to be fetched from across the road. Those are the snapshot tier and the vault tier.
If someone throws a copy away, it sits in a locked bin for 14 days before it’s really gone. That’s soft delete, and it’s also the reason the cabinet can’t be taken away while anything is still in that bin.
Engineer's View
How Azure VM backup works
- Recovery Services vault: holds the backup data and policies for VMs, SQL in VMs, Azure Files and MARS (Lesson 36). Set the storage redundancy (LRS, ZRS, GRS) and cross-region restore before you protect anything, because after that they’re locked.
- How a backup runs: the backup extension, which the VM agent installs, takes an app-consistent snapshot (VSS on Windows, a file-system freeze or pre/post scripts on Linux) and then copies the changed blocks across to the vault.
- Policies: Standard takes one backup a day. Enhanced lets you back up every 4 to 24 hours and keep snapshots for 1 to 30 days, and you need it for Ultra Disk and Premium SSD v2. Once a VM is on Enhanced, it can’t go back to Standard.
- Restore options: you can create a new VM, restore the disks, replace the disks on the existing VM, or mount a recovery point and pull out single files.
- Soft delete: it’s on by default and keeps deleted backup data for 14 days at no extra charge. You can make enhanced soft delete “always-on”, so nobody can turn it off.
- Cost: there’s a monthly protected-instance fee for each VM based on its size, and on top of that you pay for backup storage and snapshot storage.
How it works, step by step
This is what happens during one scheduled backup of web01:
- When the policy time comes, the vault tells the backup extension on web01 to start.
- The extension freezes the file system for a moment and snapshots every disk.
- That snapshot stays next to the disks as an instant restore point, for however long you set.
- The changed blocks get copied to the vault and are kept there as the vault-tier recovery point.
- The job reports Completed, and the recovery point shows up with both tiers.
A restore from the snapshot tier takes minutes. From the vault tier it takes longer, because the data has to be copied back out of the vault.
Until you’ve restored a backup, you’re only hoping it works. Restore regularly into a separate resource group and check that the app runs.
Hands-on lab: Azure VM backup and restore for web01
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
Load the IDs you’ll need and start web01:
$st = (Get-Content C:\azure-lab\storage.txt)
$web01 = az vm show --resource-group rg-saat-vms --name web01 --query id -o tsv
az vm start --resource-group rg-saat-vms --name web011Create the vault and set it to LRS first
Run this:
az backup vault create --resource-group rg-saat-core --name rsv-saat --location centralindia --tags course=saatvedha-azure lesson=35 -o none
az backup vault backup-properties set --resource-group rg-saat-core --name rsv-saat --backup-storage-redundancy LocallyRedundant --cross-region-restore-flag false -o none
az backup vault show --resource-group rg-saat-core --name rsv-saat --query "{name:name, redundancy:properties.redundancySettings.standardTierStorageRedundancy, crossRegionRestore:properties.redundancySettings.crossRegionRestore}" -o tableYou should see something like this:
Name Redundancy CrossRegionRestore
-------- ----------------- --------------------
rsv-saat LocallyRedundant DisabledNew vaults default to geo-redundant storage, and for a lab LRS cuts the storage cost in half. In production you have to decide now, because once a VM is protected you can’t change the vault’s redundancy.
2Look at the built-in policies
Run this:
az backup policy list --resource-group rg-saat-core --vault-name rsv-saat --query "[?properties.backupManagementType=='AzureIaasVM'].{name:name, type:properties.policyType}" -o tableYou should see something like this:
Name Type
-------------- ------
DefaultPolicy V1
EnhancedPolicy V2V1 is Standard and V2 is Enhanced. You’ll use EnhancedPolicy, which backs up every 4 hours and keeps snapshots for 7 days.
3Protect web01 and back it up now
Run this. The backup takes 20 to 40 minutes:
az backup protection enable-for-vm --resource-group rg-saat-core --vault-name rsv-saat --vm $web01 --policy-name EnhancedPolicy -o none
$job = az backup protection backup-now --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --retain-until (Get-Date).AddDays(30).ToString('dd-MM-yyyy') --query name -o tsv
az backup job wait --resource-group rg-saat-core --vault-name rsv-saat --name $job
az backup job show --resource-group rg-saat-core --vault-name rsv-saat --name $job --query "{operation:properties.operation, status:properties.status, duration:properties.duration}" -o tableYou should see something like this:
Operation Status Duration
----------- --------- --------------
Backup Completed 0:27:41.5510184List the recovery points
Run this:
az backup recoverypoint list --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --query "[].{name:name, time:properties.recoveryPointTime, tiers:join(', ', properties.recoveryPointTierDetails[].type)}" -o tableYou should see something like this:
Name Time Tiers
-------------- -------------------------------- ---------------------
84716539204517 2026-10-21T04:12:09.512000+00:00 InstantRP, HardenedRPInstantRP is the snapshot tier and HardenedRP is the copy in the vault. As long as the snapshot exists, restores use it.
5Restore web01 as a new VM
Restore it into a separate resource group, and then check the web page on the copy:
az group create --name rg-saat-l35 --location centralindia --tags course=saatvedha-azure lesson=35 -o none
$rp = az backup recoverypoint list --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --query "[0].name" -o tsv
$rjob = az backup restore restore-disks --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --rp-name $rp --restore-mode AlternateLocation --target-vm-name web01-restored --target-resource-group rg-saat-l35 --target-vnet-name vnet-saat --target-vnet-resource-group rg-saat-core --target-subnet-name snet-web --storage-account $st --storage-account-resource-group rg-saat-data --query name -o tsv
az backup job wait --resource-group rg-saat-core --vault-name rsv-saat --name $rjob
az vm run-command invoke --resource-group rg-saat-l35 --name web01-restored --command-id RunShellScript --scripts 'hostname; curl -s localhost' --query "value[0].message" -o tsvYou should see something like this:
Enable succeeded:
[stdout]
web01
<h1>web01</h1>
<p>SaatVedha Azure course, Lesson 15</p>
[stderr]The copy still calls itself web01, because the OS inside is the same. In a real restore test you’d also change its hostname or keep it isolated, so it doesn’t clash with the original.


✅ Checkpoint: web01 has a recovery point in both tiers, and web01-restored served the original page.
Break It, Then Fix It
First delete the restored VM so it stops costing you money:
az group delete --name rg-saat-l35 --yes1Break it: “let’s move it to the cheaper policy”
Someone tries to switch web01 from Enhanced over to the Standard policy:
az backup item set-policy --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --policy-name DefaultPolicyThe command fails because Azure won’t change the policy type. Microsoft’s documentation says plainly that a VM backed up with an Enhanced policy can’t be moved to a Standard one.
The only way round it is to stop protection, delete or keep the old data, and then protect the VM again with a Standard policy.
Fix it: if Enhanced is too expensive, create a cheaper Enhanced policy (every 24 hours, fewer snapshot days) and switch to that, since you’re allowed to change policies within the same type.
2Break it: the vault that won’t delete
Try deleting the vault while web01 is still protected:
az backup vault delete --resource-group rg-saat-core --name rsv-saat --yesYou’ll get this error:
Vault cannot be deleted as there are existing resources within the vault. Please ensure there are no backup items, protected servers, or backup management servers associated with this vault. Unregister the following containers associated with this vault before proceeding for deletion.Stop protection, delete the backup data, and try again:
az backup protection disable --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --delete-backup-data true --yes
az backup vault delete --resource-group rg-saat-core --name rsv-saat --yesYou’ll get this error:
Recovery Services vault cannot be deleted as there are backup items in soft deleted state in the vault. The soft deleted items are permanently deleted after 14 days of delete operation. Please try vault deletion after the backup items are permanently deleted and there is no item in soft deleted state left in the vault.That’s soft delete looking after you: an attacker who deletes your backups can’t delete the vault for 14 days either. It’s also the reason “clean up the lab” won’t finish today.
Fix it for the lab: bring the item back, turn soft delete off, delete the data again and then delete the vault. Never do this in production:
az backup protection undelete --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --workload-type VM -o none
az backup vault backup-properties set --resource-group rg-saat-core --name rsv-saat --soft-delete-feature-state Disable -o none
az backup protection disable --resource-group rg-saat-core --vault-name rsv-saat --container-name web01 --item-name web01 --backup-management-type AzureIaasVM --delete-backup-data true --yes
az backup vault delete --resource-group rg-saat-core --name rsv-saat --yes
az vm deallocate --resource-group rg-saat-vms --name web01
C:\azure-lab\Find-LabResources.ps1 -Lesson 35You should see this:
Nothing tagged course=saatvedha-azure is left.
✅ Checkpoint: You hit the policy-type rule and both vault delete errors, and cleaned up the right way.
The backup extension stays on web01, but without a vault it does nothing. Lesson 36 builds a new vault for the MARS agent.
This happened at work
The backups that were deleted before the ransom note
A logistics company got hit by ransomware on a Friday night. Before the attackers encrypted the servers, they used a stolen admin account to stop backup and delete the backup data for 70 VMs, and then they tried to delete the vault.
The vault delete failed, because the deleted items were sitting in soft delete for 14 days. On Monday the team undeleted the backup items and restored the VMs from recovery points taken before the attack, and they were back up in 3 days instead of rebuilding everything from scratch.
What they changed: soft delete is now always-on and immutability is locked on the vault, so not even a Global Administrator can shorten them. Critical operations need a second person to approve through Resource Guard, and backup alerts go to a mailbox that the IT admin accounts can’t touch.
Common mistakes and troubleshooting
| Mistake | What you see | What to do |
|---|---|---|
| Leaving the vault on GRS by default | Double storage cost; can’t change later | Set redundancy before protecting the first item. |
| Choosing Enhanced without a reason | Higher snapshot cost; can’t go back | Use Standard unless you need it; pick Enhanced deliberately. |
| Never testing restores | Restore fails during an incident | Restore monthly into a test resource group. |
| Turning soft delete off “to save money” | Deleted backups gone instantly | Keep it on; it has no extra charge for 14 days. |
| Restoring next to the original with the same hostname | Name and IP clashes | Isolate or rename the restored copy. |
| Deleting a vault with soft-deleted items | “Cannot be deleted as there are backup items in soft deleted state” | Wait 14 days, or undelete and delete properly in labs. |
Interview questions
Click any question to open it. They’re worded the way an interviewer would ask them, and under each one you’ll find why they ask it and one way you could answer in your own words.
Fresher level
1. What is a Recovery Services vault?
Why they ask this: It’s the basic building block.
How you might answer: It’s an Azure resource that holds backup data and policies for VMs, SQL in VMs, Azure Files and MARS backups, along with settings for redundancy, soft delete and security.
2. What restore options does Azure VM backup offer?
Why they ask this: They want to hear the full menu.
How you might answer: You can create a new VM, restore the disks, replace the disks of the VM that’s there, or mount a recovery point and get individual files back.
3. What is soft delete in Azure Backup?
Why they ask this: It’s a basic security check.
How you might answer: When backup data is deleted, it’s kept for 14 days by default so you can undelete it. That protects you against mistakes and against attackers who go after the backups.
2–5 years experience
4. Standard or Enhanced policy: how do you choose?
Why they ask this: They want to hear the trade-offs.
How you might answer: Standard takes one backup a day and costs less. Enhanced gives you several backups a day and longer snapshot retention, and it supports Ultra Disk and Premium SSD v2. You can’t move a VM from Enhanced back to Standard, so I pick it on purpose.
5. A VM backup job fails. What do you check?
Why they ask this: It’s a troubleshooting path you’ll walk often.
How you might answer: I’d check the VM agent and the backup extension status, the job’s error code, disk and snapshot limits, any VSS or file-system freeze errors inside the VM, and whether the VM is running. The error code usually names the cause and links to the fix.
6. Why can’t you delete a Recovery Services vault?
Why they ask this: It’s a common ticket.
How you might answer: It still has protected items, registered servers or soft-deleted items. You stop protection and delete the data, then wait for soft delete to run out. In a lab you can undelete, turn soft delete off and delete again.
Senior level
7. How would you protect backups against ransomware?
Why they ask this: They want to see layered defence.
How you might answer: I’d turn on always-on soft delete, lock immutability and use multi-user authorization with Resource Guard. Backup gets its own admin accounts, deleting a backup triggers an alert, and critical systems also get cross-region or cross-subscription copies.
8. How do you design backup for 1,000 VMs?
Why they ask this: They want to hear about scale and governance.
How you might answer: I’d use Azure Policy to switch on backup automatically by tag, keep a few standard policies by tier, and have vaults per region and environment. Then Backup Center for monitoring, regular restore tests, and reports on unprotected VMs and failed jobs.
9. What RPO and RTO can Azure VM backup give?
Why they ask this: They want realistic numbers.
How you might answer: Standard gives you an RPO of about 24 hours, and Enhanced gets it down to 4 hours. RTO depends on the restore type: from a snapshot it’s minutes, from the vault it’s longer. If they need lower RPO and RTO, I’d add Azure Site Recovery (Lesson 39).
Quick quiz
Q1. When must you set a vault’s storage redundancy?
- Any time
- Before protecting the first item
- After the first backup
- Never
Show answer
B — It can’t be changed once items are protected.
Q2. Which policy type allows backups every 4 hours?
- Standard
- Enhanced
- Archive
- Default
Show answer
B — Enhanced supports multiple backups a day.
Q3. Can a VM move from Enhanced to Standard policy?
- Yes
- No
- Only on Linux
- Only with GRS
Show answer
B — Changing back to Standard isn’t supported.
Q4. How long are soft-deleted backups kept by default?
- 1 day
- 7 days
- 14 days
- 90 days
Show answer
C — Soft delete keeps them 14 days.
Q5. Which tier gives the fastest restore?
- Vault tier
- Snapshot (instant restore) tier
- Archive tier
- Cool tier
Show answer
B — Snapshots restore in minutes.
Quick recap
You can now protect a VM, prove its backup works, and handle the vault without hurting yourself.
- Set vault redundancy before protecting anything.
- Standard: daily. Enhanced: up to every 4 hours, and no way back.
- Test restores into a separate resource group.
- Soft delete keeps deleted backups 14 days and blocks vault deletion.
- Protect backups from admins with always-on soft delete and Resource Guard.
Next lesson
Lesson 36: Azure Backup MARS agent: files and folders → Next, you back up chosen folders from a Windows server with the MARS agent and restore a single file.
Further reading: Azure VM backup
Want to go deeper into Azure VM backup? Microsoft’s About Azure VM backup and Delete a Recovery Services vault are good next reads, and the full plan for this course is on the Azure Cloud Administration course page.
