AZ-104 Refresher Chapter 10 Β· Backup & disaster recovery

Chapter 10

Backup & disaster recovery

πŸ“– Theory 30 minπŸ›  Lab 20 min + cleanupMonitor & maintain Β· 10–15%

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.

Part A

Theory

Backup or disaster recovery?

Two numbers drive every design in this area:

Azure BackupAzure Site Recovery
Protects againstDeletion, corruption, ransomware, "go back to last Tuesday"Outage of a region or datacenter
HowPoint-in-time copies, kept for days to yearsContinuous replication to another region
Typical RPOHours (daily or every few hours)Seconds to minutes
Typical RTOHours (restore takes time)Minutes (fail over, VMs start)
Vault locationSame 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 vaultBackup vault
  • Azure VMs
  • SQL Server and SAP HANA in Azure VMs
  • Azure Files
  • On-premises files/folders (MARS agent), and servers via MABS/DPM
  • Azure Site Recovery replication
  • Azure Blobs (operational and vaulted)
  • Azure Disks (managed disk snapshots)
  • Azure Database for PostgreSQL (flexible server)
  • AKS clusters
  • Azure Data Lake Storage

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

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

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

OptionWhat happensUse when
Create new VMA new VM from the recovery pointQuick test or a side-by-side copy
Restore disksDisks (and a template) in a resource group you chooseYou want to customise the VM before creating it
Replace existingSwaps the disks of the existing VMRoll back the VM in place (the current disks are kept as a backup)
Cross Region RestoreRestore in the paired regionPrimary region unavailable (GRS vault)
File RecoveryMounts a recovery point as a drive with a scriptYou need a few files, not the whole VM
Exam trap

"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

Backup reports and alerts

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.

Primary regionwesteurope vm-web2Mobility serviceextension Cache storageaccount every write iscaptured and sent continuous replication Target (DR) regionnortheurope rsv-az104-drRecovery Servicesvault Replica disks+ recovery points VM afterfailovertarget VNet
Nothing runs in the target region until you fail over; you pay for storage and the ASR licence per protected VM.

Setting it up

  1. Create a Recovery Services vault in the target region.
  2. Enable replication for the VMs: choose the target region, resource group, VNet (network mapping), availability (zone/set), and a replication policy.
  3. The replication policy sets recovery point retention (up to 15 days) and how often app-consistent snapshots are taken.
  4. 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

Exam trap

"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 link

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.

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.

Part B

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
  1. Task

    Back up vm-web1

    Create a Recovery Services vault rsv-az104 in the right region for backing up vm-web1, with LRS storage (to save cost in this lab). Protect vm-web1 with a policy that fits a Trusted launch VM, keeping daily points for 7 days, and start a backup now.

    Done when
    • vm-web1 appears 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
    1. Create a resource β†’ Backup and Site Recovery (Recovery Services vault): rsv-az104, region westeurope (same as the VM).
    2. Vault β†’ Settings β†’ Properties β†’ Backup Configuration β†’ Update: Locally-redundant β†’ Save.
    3. Vault β†’ Backup: Azure, Virtual machine β†’ policy subtype Enhanced β†’ create policy pol-vm-enhanced (every 24 hours, daily retention 7 days, instant restore 2 days) β†’ add vm-web1 β†’ Enable backup.
    4. 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
  2. Task

    Back up the file share and restore a single file

    Protect share1 (chapter 7) in rsv-az104 with a daily policy and take an on-demand backup. Then delete from-vm.txt from the share and restore only that file from the backup.

    Done when
    • from-vm.txt is back in share1.
    • You noticed that the storage firewall didn't block Azure Backup. Which exception allowed it?
    Solution Β· Portal
    1. Vault β†’ Backup: Azure, Azure Files (Azure Storage) β†’ select storage account β†’ Add share1 β†’ policy (default daily is fine) β†’ Enable backup.
    2. Backup items β†’ Azure Storage (Azure Files) β†’ share1 β†’ Backup now.
    3. Delete from-vm.txt in the portal (Storage account β†’ File shares β†’ share1).
    4. 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).

  3. Task

    Protect the blobs with a Backup vault

    Create a Backup vault bvault-az104 and 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
    1. Create a resource β†’ Backup vault: bvault-az104, region westeurope, redundancy LRS.
    2. Vault β†’ + Backup β†’ datasource Azure Blobs (Azure Storage) β†’ policy: new, Operational, 7 days β†’ select the storage account.
    3. 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.
  4. Task

    Hear about backup problems

    Make sure that built-in backup alerts for rsv-az104 reach ag-az104-email (chapter 9), and that Backup reports get data from the vault in log-az104.

    Done when
    • An alert processing rule routes backup alerts to the action group.
    • rsv-az104 has a diagnostic setting to log-az104 in resource-specific mode.
    Solution Β· Portal
    1. Monitor β†’ Alerts β†’ Alert processing rules β†’ Create: scope rsv-az104, rule type Apply action group β†’ ag-az104-email, schedule Always, name apr-backup-notify.
    2. rsv-az104 β†’ Monitoring β†’ Diagnostic settings β†’ Add: tick the Azure Backup reporting categories (CoreAzureBackup, AddonAzureBackupJobs, AddonAzureBackupPolicy, AddonAzureBackupStorage, AddonAzureBackupProtectedInstance…), destination log-az104, Resource specific.
    3. Later: Business Continuity Center β†’ Reports (data appears after a few hours).
  5. Task

    Replicate vm-web2 to the DR region

    Set up Site Recovery for vm-web2 to northeurope. Create the vault rsv-az104-dr in 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 when
    • rsv-az104-dr β†’ Replicated items shows vm-web2 with status Protected (after initial sync).
    • You can say why this vault is in a different region from rsv-az104.
    Solution Β· Portal
    1. Create a Recovery Services vault rsv-az104-dr in northeurope (target region), resource group rg-az104-lab.
    2. 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, vault rsv-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.

  6. Task

    Practise restores while you wait

    When the vm-web1 backup 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.

  7. Task

    Run a disaster recovery drill

    When vm-web2 is Protected: create an isolated VNet vnet-dr-test (10.99.0.0/16) in the DR region and run a test failover of vm-web2 into it with the latest processed recovery point. Check the test VM runs, then clean up the test failover.

    Done when
    • A VM vm-web2-test ran in northeurope while production kept running.
    • After cleanup, the replicated item is back to Protected without a test VM.
    Solution Β· Portal
    1. Create VNet vnet-dr-test (10.99.0.0/16, one subnet 10.99.1.0/24) in rg-az104-lab-asr, region northeurope.
    2. rsv-az104-dr β†’ Replicated items β†’ vm-web2 β†’ Test failover: recovery point Latest processed, VNet vnet-dr-test β†’ OK.
    3. When the job finishes, look at the VM in the DR resource group (Run command hostname; curl -s localhost).
    4. Replicated item β†’ Cleanup test failover β†’ add a note, tick Testing is complete β†’ OK.

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.

  1. 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
    1. rsv-az104-dr β†’ Replicated items β†’ vm-web2 β†’ Disable replication.
    2. rsv-az104 β†’ Properties β†’ Security settings β†’ Soft delete and security settings β†’ Update: untick soft delete (for cloud workloads) β†’ Update.
    3. Backup items β†’ each item β†’ Stop backup β†’ Delete backup data (type the item name). Also Backup infrastructure β†’ Storage accounts β†’ Unregister the storage account.
    4. 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
  2. Task

    Remove what lives outside the resource group

    Some things you created aren't in rg-az104-lab. Find and remove them: the lock on vnet-hub (it blocks the group's deletion), the subscription diagnostic setting, the ASR resource group, and optionally the budget and management group.

    Done when
    • az lock list -g rg-az104-lab returns 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-lab

    If you did the optional DNS task: also delete the four lab NS records at your registrar. The Azure DNS zone itself is deleted with the resource group.

  3. 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 when
    • az group exists -n rg-az104-lab returns false. 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
  4. 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
Finished

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.