Chapter 10
Backup & disaster recovery
The last chapter protects what you built: Azure Backup for "I deleted something" and Azure Site Recovery for "the whole region is down". It ends with a full cleanup of the lab, which is a good exercise in itself: locks, soft delete and replication all try to stop you.
Theory
Backup or disaster recovery?
Two numbers drive every design in this area:
- RPO (recovery point objective): how much data you can afford to lose, measured in time. "RPO 24 hours" means a daily backup is fine.
- RTO (recovery time objective): how long the service may be down while you recover.
| Azure Backup | Azure Site Recovery | |
|---|---|---|
| Protects against | Deletion, corruption, ransomware, "go back to last Tuesday" | Outage of a region or datacenter |
| How | Point-in-time copies, kept for days to years | Continuous replication to another region |
| Typical RPO | Hours (daily or every few hours) | Seconds to minutes |
| Typical RTO | Hours (restore takes time) | Minutes (fail over, VMs start) |
| Vault location | Same region as the source (for VMs) | Target (DR) region |
Most production workloads use both: Site Recovery to survive a region outage, Backup to recover from mistakes. Replication faithfully copies a deletion or ransomware encryption too, so it's not a backup.
Two kinds of vault
Backups are stored in a vault. There are two types, and the exam asks which one protects what:
| Recovery Services vault | Backup vault |
|---|---|
|
|
Both are managed together in Azure Business Continuity Center (formerly Backup center), which gives one view of protected items, jobs, policies and alerts across vaults and subscriptions.
Vault settings that matter
- Storage redundancy: GRS (default), ZRS or LRS. You can only change it before the first item is protected.
- Cross Region Restore (GRS vaults): restore in the paired region at any time, not just after Microsoft declares a disaster.
- Soft delete: deleted backup data is kept for 14 days (configurable in enhanced soft delete) so an attacker or mistake can't wipe your backups. It can be made always-on (irreversible).
- Immutable vault: prevents operations that would reduce retention or delete recovery points.
- Multi-user authorization with a Resource Guard: critical operations (like disabling soft delete) need approval from a second person in another tenant or subscription.
Backing up Azure VMs
When you enable backup on a VM, Azure installs a backup extension. At backup time it takes a snapshot of the disks (an instant restore point that stays next to the VM for fast restores) and then transfers the data to the vault.
Backup policies
- Standard policy: one backup per day (or week).
- Enhanced policy: backups every 4, 6, 8, 12 or 24 hours, instant restore points kept up to 30 days, and support for Trusted launch VMs, Premium SSD v2 and Ultra disks. Trusted launch VMs need the Enhanced policy, so your lab VMs do.
- Retention: daily, weekly, monthly and yearly points, up to 99 years.
Consistency: Windows backups are application-consistent using VSS. Linux backups are file-system consistent, or application-consistent if you add pre/post scripts. If the VM is off, the backup is crash-consistent.
You can also run Backup now (an on-demand backup with its own retention date), for example before a risky change.
Restore options
| Option | What happens | Use when |
|---|---|---|
| Create new VM | A new VM from the recovery point | Quick test or a side-by-side copy |
| Restore disks | Disks (and a template) in a resource group you choose | You want to customise the VM before creating it |
| Replace existing | Swaps the disks of the existing VM | Roll back the VM in place (the current disks are kept as a backup) |
| Cross Region Restore | Restore in the paired region | Primary region unavailable (GRS vault) |
| File Recovery | Mounts a recovery point as a drive with a script | You need a few files, not the whole VM |
"You need to recover one deleted file from a VM backup, as fast as possible." Use File Recovery: download the script, run it on a machine (same or compatible OS), and copy the files from the mounted volume. Restoring the whole VM is slower. Also remember: the Recovery Services vault must be in the same region as the VMs it backs up.
Files, blobs and on-premises
- Azure Files (Recovery Services vault): based on share snapshots taken on a schedule. Restore the whole share or individual files, to the original or another location. A newer vaulted tier also copies the data into the vault.
- Azure Blobs (Backup vault):
- Operational backup: continuous, kept in the storage account itself (using soft delete, versioning, change feed and point-in-time restore). Protects against deletion/corruption, but not against losing the account.
- Vaulted backup: scheduled copies into the Backup vault, so they survive deletion of the account.
- On-premises: the MARS agent backs up files, folders and system state of Windows machines directly to a Recovery Services vault. For applications (SQL, Exchange, Hyper-V) use MABS or DPM.
Backup reports and alerts
- Backup jobs in the vault or Business Continuity Center show each job's status, duration and errors.
- Built-in Azure Monitor alerts for backup (job failures, security events like "soft delete disabled") are generated automatically. To get notified, route them to an action group with an alert processing rule (chapter 9). The old "classic" backup alerts are being retired.
- Backup reports (trends in storage, jobs, policies, optimisation) need a diagnostic setting on each vault sending data to a Log Analytics workspace in resource-specific mode.
Azure Site Recovery
Azure Site Recovery (ASR) continuously replicates VMs to another region (or on-premises VMware, Hyper-V and physical servers to Azure), so you can fail over when the primary site is unavailable.
Setting it up
- Create a Recovery Services vault in the target region.
- Enable replication for the VMs: choose the target region, resource group, VNet (network mapping), availability (zone/set), and a replication policy.
- The replication policy sets recovery point retention (up to 15 days) and how often app-consistent snapshots are taken.
- Group VMs into a recovery plan: the order in which they start (database before web tier), plus manual actions or Automation runbooks (e.g. update DNS).
Failover types
- Test failover: creates the VMs in an isolated VNet you choose. Replication continues, production isn't affected. Do this regularly to prove DR works, then Cleanup test failover.
- Failover (unplanned): for a real disaster. You pick a recovery point: Latest (lowest RPO, slower), Latest processed (lowest RTO), Latest app-consistent, or a custom point.
- After failover: Commit (no more switching to other recovery points), then Re-protect (replicate back from the DR region), and later fail back to the primary region.
"Where do you create the Recovery Services vault for Site Recovery of VMs in West Europe to North Europe?" In the target region (North Europe). For Backup of the same VMs, the vault goes in the source region (West Europe). Same vault type, opposite locations.
AZ-305 has a whole area on "design business continuity". You get an RPO/RTO and a budget and must choose: Backup only, Backup + ASR, zone redundancy instead of region DR, or an active-active design with Front Door. Remember the cheap-to-expensive scale: backup β zone-redundant β ASR β active-active multi-region.
- What is Azure Backup?
- Backup vault overview
- Recovery Services vault overview
- About Azure VM backup
- Enhanced policy for VM backup
- Restore Azure VMs
- Azure Blob backup overview
- Soft delete for Azure Backup
- Configure Backup reports
- About Site Recovery
- Tutorial: set up DR for Azure VMs
- Tutorial: run a DR drill
Self-check
1. You need to back up Azure Blobs so the copies survive even if the storage account is deleted. What do you use?
B. Operational backup and soft delete keep data inside the account.
2. A Trusted launch VM can't be added to a backup policy that runs once a day. Why?
C. (An Enhanced policy can still run daily.)
3. You must prove twice a year that DR works without affecting production. What do you do?
A. That's exactly what test failover is for.
4. You try to delete a Recovery Services vault and get an error, although you stopped all backups and deleted the data. Why?
D. Undelete them, disable soft delete, delete again, then delete the vault (or wait 14 days).
5. During a regional outage you fail over with ASR and want the shortest possible downtime. Which recovery point?
B. "Latest" gives the lowest RPO but must process pending data first, so it takes longer.
Lab: protect it, prove it, then delete everything
Some jobs here (the first VM backup, initial ASR replication) take 30β60 minutes in the background. Start them, continue with the next steps, and come back. Paste the variables first:
RG=rg-az104-lab; LOC=westeurope; LOC2=northeurope; INIT=xx
ST=staz104${INIT}01
az vm start -g $RG -n vm-web1 --no-wait; az vm start -g $RG -n vm-web2 --no-wait
-
Task
Back up
vm-web1Create a Recovery Services vault
rsv-az104in the right region for backing upvm-web1, with LRS storage (to save cost in this lab). Protectvm-web1with a policy that fits a Trusted launch VM, keeping daily points for 7 days, and start a backup now.Done whenvm-web1appears under Backup items, and a Backup job is running or completed.- You know why the storage redundancy had to be set before protecting the VM.
Solution Β· Portal
- Create a resource β Backup and Site Recovery (Recovery Services vault):
rsv-az104, region westeurope (same as the VM). - Vault β Settings β Properties β Backup Configuration β Update: Locally-redundant β Save.
- Vault β Backup: Azure, Virtual machine β policy subtype Enhanced β create policy
pol-vm-enhanced(every 24 hours, daily retention 7 days, instant restore 2 days) β addvm-web1β Enable backup. - Backup items β Azure Virtual Machine β vm-web1 β Backup now.
Solution Β· Azure CLI
az backup vault create -g $RG -n rsv-az104 -l $LOC az backup vault backup-properties set -g $RG -n rsv-az104 --backup-storage-redundancy LocallyRedundant az backup policy list -g $RG -v rsv-az104 --query "[].{name:name, type:properties.policyType}" -o table # New vaults include "EnhancedPolicy"; if not, create one in the portal. az backup protection enable-for-vm -g $RG -v rsv-az104 --vm vm-web1 --policy-name EnhancedPolicy az backup protection backup-now -g $RG -v rsv-az104 -c vm-web1 -i vm-web1 \ --backup-management-type AzureIaasVM --retain-until $(date -u -d '+7 days' +%d-%m-%Y) az backup job list -g $RG -v rsv-az104 -o table -
Task
Back up the file share and restore a single file
Protect
share1(chapter 7) inrsv-az104with a daily policy and take an on-demand backup. Then deletefrom-vm.txtfrom the share and restore only that file from the backup.Done whenfrom-vm.txtis back inshare1.- You noticed that the storage firewall didn't block Azure Backup. Which exception allowed it?
Solution Β· Portal
- Vault β Backup: Azure, Azure Files (Azure Storage) β select storage account β Add
share1β policy (default daily is fine) β Enable backup. - Backup items β Azure Storage (Azure Files) β share1 β Backup now.
- Delete
from-vm.txtin the portal (Storage account β File shares β share1). - Backup item β File Recovery β restore point β Original location β Add file β
from-vm.txtβ Restore.
The exception Allow Azure services on the trusted services list (chapter 7, step 7).
-
Task
Protect the blobs with a Backup vault
Create a Backup vault
bvault-az104and configure operational backup of the blobs in your storage account, with 7 days retention. The vault needs a permission on the storage account; let the portal grant it.Done when- The backup instance for your storage account shows Protection configured.
- You can name the role the vault received.
Solution Β· Portal
- Create a resource β Backup vault:
bvault-az104, region westeurope, redundancy LRS. - Vault β + Backup β datasource Azure Blobs (Azure Storage) β policy: new, Operational, 7 days β select the storage account.
- Validation shows the missing role β Assign missing roles (it assigns Storage Account Backup Contributor to the vault's managed identity) β wait a minute β Revalidate β Configure backup.
-
Task
Hear about backup problems
Make sure that built-in backup alerts for
rsv-az104reachag-az104-email(chapter 9), and that Backup reports get data from the vault inlog-az104.Done when- An alert processing rule routes backup alerts to the action group.
rsv-az104has a diagnostic setting tolog-az104in resource-specific mode.
Solution Β· Portal
- Monitor β Alerts β Alert processing rules β Create: scope
rsv-az104, rule type Apply action group βag-az104-email, schedule Always, nameapr-backup-notify. rsv-az104β Monitoring β Diagnostic settings β Add: tick the Azure Backup reporting categories (CoreAzureBackup, AddonAzureBackupJobs, AddonAzureBackupPolicy, AddonAzureBackupStorage, AddonAzureBackupProtectedInstanceβ¦), destinationlog-az104, Resource specific.- Later: Business Continuity Center β Reports (data appears after a few hours).
-
Task
Replicate
vm-web2to the DR regionSet up Site Recovery for
vm-web2to northeurope. Create the vaultrsv-az104-drin the right region, and let Site Recovery create the target resource group and VNet. Initial replication takes a while; carry on with step 6 while it runs.Done whenrsv-az104-drβ Replicated items showsvm-web2with status Protected (after initial sync).- You can say why this vault is in a different region from
rsv-az104.
Solution Β· Portal
- Create a Recovery Services vault
rsv-az104-drin northeurope (target region), resource grouprg-az104-lab. vm-web2β Backup + disaster recovery β Disaster recovery: target region northeurope β Advanced settings: target subscription, resource group (new, e.g.rg-az104-lab-asr), virtual network (new, created by ASR), availability zone, vaultrsv-az104-dr, replication policy (default 24-hour retention) β Start replication.
For DR, the vault goes in the target region so it's available when the source region isn't.
-
Task
Practise restores while you wait
When the
vm-web1backup job has finished: find the restore options for a recovery point, and generate (don't run) the File Recovery script. Decide which option you'd use to (a) get one config file back, (b) roll back the whole VM in place, (c) inspect the old disks without touching production.Done when- You've seen the restore wizard and can answer (a), (b) and (c).
Solution Β· Portal
rsv-az104β Backup items β vm-web1: Restore VM shows Create new (virtual machine or Restore disks) and Replace existing; File Recovery β pick a point β Download Executable (a script plus password that mounts the point via iSCSI). Answers: (a) File Recovery, (b) Replace existing, (c) Restore disks. -
Task
Run a disaster recovery drill
When
vm-web2is Protected: create an isolated VNetvnet-dr-test(10.99.0.0/16) in the DR region and run a test failover ofvm-web2into it with the latest processed recovery point. Check the test VM runs, then clean up the test failover.Done when- A VM
vm-web2-testran in northeurope while production kept running. - After cleanup, the replicated item is back to Protected without a test VM.
Solution Β· Portal
- Create VNet
vnet-dr-test(10.99.0.0/16, one subnet 10.99.1.0/24) inrg-az104-lab-asr, region northeurope. rsv-az104-drβ Replicated items β vm-web2 β Test failover: recovery point Latest processed, VNetvnet-dr-testβ OK.- When the job finishes, look at the VM in the DR resource group (Run command
hostname; curl -s localhost). - Replicated item β Cleanup test failover β add a note, tick Testing is complete β OK.
- A VM
Cleanup: delete the whole lab
When you're done (and only then), remove everything so it stops costing money. This is also a lesson: locks, soft delete and replication all block deletion, in that order of surprise.
-
Task
Stop Site Recovery and Backup properly
Disable replication of
vm-web2. In both Recovery Services vaults and the Backup vault, disable soft delete first, then stop protection and delete the backup data of every item.Done when- All three vaults have zero protected and zero soft-deleted items.
If an item is already soft-deleted
Turn off soft delete, Undelete the item, then Stop backup β Delete backup data again. If soft delete was set to always-on, you have to wait for the retention period (14 days) to end.
Solution Β· Portal
rsv-az104-drβ Replicated items β vm-web2 β Disable replication.rsv-az104β Properties β Security settings β Soft delete and security settings β Update: untick soft delete (for cloud workloads) β Update.- Backup items β each item β Stop backup β Delete backup data (type the item name). Also Backup infrastructure β Storage accounts β Unregister the storage account.
- Same for
bvault-az104: Properties β soft delete off; Backup instances β Delete.
Solution Β· Azure CLI (Recovery Services vault)
az backup vault backup-properties set -g $RG -n rsv-az104 --soft-delete-feature-state Disable az backup protection disable -g $RG -v rsv-az104 -c vm-web1 -i vm-web1 \ --backup-management-type AzureIaasVM --delete-backup-data true --yes az backup item list -g $RG -v rsv-az104 -o table # repeat disable for any remaining item -
Task
Remove what lives outside the resource group
Some things you created aren't in
rg-az104-lab. Find and remove them: the lock onvnet-hub(it blocks the group's deletion), the subscription diagnostic setting, the ASR resource group, and optionally the budget and management group.Done whenaz lock list -g rg-az104-labreturns nothing.- No diagnostic setting on the subscription points at
log-az104.
Solution Β· Azure CLI
az lock delete -n lock-hub-nodelete -g $RG --resource-name vnet-hub --resource-type Microsoft.Network/virtualNetworks az monitor diagnostic-settings subscription delete -n diag-activity --yes az group list --query "[?contains(name,'az104') || contains(name,'asr')].name" -o tsv az group delete -n rg-az104-lab-asr --yes --no-wait # the DR resource group from step 5 # optional: Cost Management β Budgets β delete budget-az104-lab # optional: az account management-group delete -n mg-az104-labIf you did the optional DNS task: also delete the four
labNS records at your registrar. The Azure DNS zone itself is deleted with the resource group. -
Task
Delete the resource group
Delete
rg-az104-lab. If it fails, the error message tells you what is still blocking it (a lock, a vault with items, a resource in use).Done whenaz group exists -n rg-az104-labreturnsfalse. The Container Apps environment's managed resource group disappears with it.
Solution Β· Azure CLI
az group delete -n $RG --yes az group exists -n $RG -
Task
Clean up Entra ID
Delete Ada, Ben, the guest, both groups, set SSPR back to None (if this is the state you started with), and remove the trial license if you don't want it.
Solution Β· Azure CLI
DOMAIN=$(az rest --url https://graph.microsoft.com/v1.0/domains --query "value[?isDefault].id" -o tsv) az ad user delete --id az104-ada@$DOMAIN az ad user delete --id az104-ben@$DOMAIN az ad group delete -g az104-admins az ad group delete -g az104-dept-it # guest and SSPR: Entra admin center β Users / Protection β Password reset
You've refreshed all five AZ-104 areas and built, monitored, protected and removed a complete environment. Next steps:
- Take the free AZ-104 practice assessment to find weak spots, and reread those chapters.
- For AZ-305, go through the purple AZ-305 link boxes again; they're the bridge to the design exam.