Azure Site Recovery: VM disaster recovery

Azure Site Recovery (ASR) keeps a running copy of your VMs’ disks in another region, usually a few seconds to minutes behind. If the whole primary region goes down, you fail over and start the VMs in the second region. A backup (Lesson 35) gives you back yesterday’s data, whereas ASR gets the service running again in minutes.

What most teams skip is the test. ASR has a test failover that starts a copy in an isolated network without touching production, and that test is what auditors ask about, and what saves you in a real outage.

In the lab you’ll replicate web01 from Central India to South India, run a test failover, and then fix two problems that quietly ruin DR plans: replication that has stopped, and a test nobody cleaned up.

TimeYou needCostBy the end you can
About 2 hours (initial replication takes 30 to 60 minutes)web01, vnet-saat, the CLI and the portalAbout 20 US cents: the protected instance has no ASR charge for its first 31 days, but replica disks, cache storage, a NAT Gateway and the test VM bill for a few hoursReplicate VMs to another region, test failover safely, and troubleshoot replication health

What it is, in one line

Azure Site Recovery continuously copies a VM’s disks to another region so you can start it there if the primary region fails.

In Simple Words

The spare school building

A school keeps a spare building in the next town, and every few minutes a clerk copies whatever has changed in the main register into the spare building’s register. That’s replication.

If the main building floods, classes move across and carry on, having lost only the last few minutes of entries. That’s a failover.

Once a term the school holds a fire drill in a separate hall of the spare building so real classes aren’t disturbed, and that’s a test failover. If nobody clears the drill away afterwards, it blocks the next one and keeps costing money.

Engineer's View

How Azure-to-Azure Site Recovery works

  • Vault: a Recovery Services vault that sits in the target region (South India here), not in the source.
  • Mobility service: an extension on the VM that captures disk writes and sends them to a cache storage account in the source region, from where ASR applies them to replica managed disks in the target region.
  • Network: the VM needs outbound HTTPS to Entra ID, the ASR service endpoints and the cache storage account, so private subnets need NAT, a firewall or service tags in an NSG.
  • Replication policy: sets how long recovery points are kept (up to 15 days) and how often app-consistent snapshots are taken. Crash-consistent points get created every few minutes anyway.
  • Failover types: a test failover puts a copy in an isolated VNet and leaves production alone, a failover (planned or unplanned) starts the VMs in the target, and after that you commit and re-protect to replicate back.
  • Recovery plans: let you group VMs, set the start order and add scripts or runbooks for multi-tier apps.
  • Cost: there’s no ASR charge per protected instance for its first 31 days, but replica storage, cache storage, transactions and any failover compute are billed.

How it works, step by step

Here’s what happens once you enable replication on web01:

Azure Site Recovery replication flow for an Azure VM
  1. ASR installs the mobility service extension on web01 and creates a cache storage account in Central India.
  2. It copies each disk once to replica disks in South India, which is the initial replication.
  3. After that, each write on web01 is captured and sent through the cache account to the replicas.
  4. Every few minutes ASR creates a crash-consistent recovery point, and the gap between that point and now is your RPO.
  5. When you fail over, ASR builds a VM in South India from the recovery point you chose and attaches it to the target VNet.

If step 3 stops because of a network change or an agent problem, the replicas stay frozen at the last good point, and the RPO grows quietly unless someone is watching replication health.

Azure Site Recovery failover types: test, planned and unplanned

You can only call a DR plan real once a test failover has passed, the app has worked in the test network, and the test has been cleaned up.

Hands-on lab: Azure Site Recovery 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 network IDs, start web01, and give snet-web an outbound path so the mobility service can talk to Azure:

$v = Get-Content C:\azure-lab\vnet-saat.json | ConvertFrom-Json
$sub = az account show --query id -o tsv
az vm start --resource-group rg-saat-vms --name web01
az network public-ip create --resource-group rg-saat-core --name pip-saat-natgw --sku Standard --location centralindia --tags course=saatvedha-azure lesson=39 -o none
az network nat gateway create --resource-group rg-saat-core --name natgw-saat --public-ip-addresses pip-saat-natgw --idle-timeout 4 --location centralindia --tags course=saatvedha-azure lesson=39 -o none
az network vnet subnet update --ids $v.'snet-web' --nat-gateway natgw-saat -o none

1Build the DR side in South India

You need a resource group, a DR VNet for real failovers, an isolated VNet for tests, and the vault in the target region:

az group create --name rg-saat-dr --location southindia --tags course=saatvedha-azure lesson=39 -o none
az network vnet create --resource-group rg-saat-dr --name vnet-saat-dr --location southindia --address-prefixes 10.50.0.0/16 --subnet-name snet-web --subnet-prefixes 10.50.1.0/24 -o none
az network vnet create --resource-group rg-saat-dr --name vnet-saat-drtest --location southindia --address-prefixes 10.51.0.0/16 --subnet-name snet-web --subnet-prefixes 10.51.1.0/24 -o none
az backup vault create --resource-group rg-saat-dr --name rsv-saat-dr --location southindia -o none
az resource list --resource-group rg-saat-dr --query "[].{name:name, type:type, location:location}" -o table

You should see something like this:

Name              Type                                  Location
----------------  ------------------------------------  ----------
vnet-saat-dr      Microsoft.Network/virtualNetworks     southindia
vnet-saat-drtest  Microsoft.Network/virtualNetworks     southindia
rsv-saat-dr       Microsoft.RecoveryServices/vaults     southindia

Notice the test VNet isn’t peered or connected to anything, and that’s deliberate, because a test copy of web01 must never talk to production.

2Enable replication for web01

In the portal, open web01 and go to Disaster recovery. Set Target region to South India. Under Advanced settings pick resource group rg-saat-dr, virtual network vnet-saat-dr and subnet snet-web, leave the cache storage and replication policy on their defaults, and set the vault to rsv-saat-dr.

Review and start replication.

Azure Site Recovery enable replication settings
Replication settings for web01 to South India.

You can follow progress from the CLI (initial replication takes 30 to 60 minutes):

az rest --method get --url "https://management.azure.com/subscriptions/$sub/resourceGroups/rg-saat-dr/providers/Microsoft.RecoveryServices/vaults/rsv-saat-dr/replicationProtectedItems?api-version=2023-08-01" --query "value[].{vm:properties.friendlyName, health:properties.replicationHealth, state:properties.protectionStateDescription, testFailover:properties.testFailoverStateDescription}" -o table

When it’s done, you should see something like this:

Vm     Health    State      TestFailover
-----  --------  ---------  --------------
web01  Normal    Protected  None

3Run a test failover

In the vault, open Replicated items, then web01, then Test failover. Pick Latest processed (low RTO) and the Azure virtual network vnet-saat-drtest, and start it.

ASR creates a VM named web01-test in rg-saat-dr.

Azure Site Recovery test failover job
Test failover of web01 into the isolated vnet-saat-drtest.

Once the job finishes, check that the copy serves the page:

az vm run-command invoke --resource-group rg-saat-dr --name web01-test --command-id RunShellScript --scripts 'hostname -I; curl -s localhost' --query "value[0].message" -o tsv

You should see something like this:

Enable succeeded: 
[stdout]
10.51.1.4 
<h1>web01</h1>
<p>SaatVedha Azure course, Lesson 15</p>

[stderr]

It’s the same app, now on a 10.51 address in the isolated test network in another region, and that’s the evidence a DR test is supposed to give you.

4Clean up the test failover

In Replicated items, open web01 and choose Cleanup test failover. Write a short note (“Lesson 39 drill passed”), tick Testing is complete and confirm, and ASR deletes web01-test.

az rest --method get --url "https://management.azure.com/subscriptions/$sub/resourceGroups/rg-saat-dr/providers/Microsoft.RecoveryServices/vaults/rsv-saat-dr/replicationProtectedItems?api-version=2023-08-01" --query "value[].{vm:properties.friendlyName, health:properties.replicationHealth, state:properties.protectionStateDescription, testFailover:properties.testFailoverStateDescription}" -o table

You should see something like this:

Vm     Health    State      TestFailover
-----  --------  ---------  --------------
web01  Normal    Protected  None
Azure Site Recovery lab: replication health and a test failover
Replication is Normal, the test copy served the page from 10.51.1.4, and cleanup is done.

✅ Checkpoint: web01 replicates to South India, a test failover served the page from the isolated network, and the test was cleaned up.

Break It, Then Fix It

Both of these leave you with a DR plan that still looks fine on paper.

1Break it: replication quietly stops

Remove the NAT Gateway from snet-web, the way a network cleanup might, and check again after 30 minutes:

az network vnet subnet update --ids $v.'snet-web' --remove natGateway -o none
Start-Sleep -Seconds 1800
az rest --method get --url "https://management.azure.com/subscriptions/$sub/resourceGroups/rg-saat-dr/providers/Microsoft.RecoveryServices/vaults/rsv-saat-dr/replicationProtectedItems?api-version=2023-08-01" --query "value[].{vm:properties.friendlyName, health:properties.replicationHealth, state:properties.protectionStateDescription, testFailover:properties.testFailoverStateDescription}" -o table

You should see something like this:

Vm     Health    State      TestFailover
-----  --------  ---------  --------------
web01  Critical  Protected  None

The state still says Protected, but health is Critical. The mobility service can’t reach Azure, so new writes aren’t getting to South India and the RPO keeps growing. In the portal, the item’s errors point to connectivity from the VM to the Site Recovery endpoints. If you failed over now, you’d lose everything written since the NAT Gateway was removed.

To fix it, give the VM its outbound access back (a NAT Gateway, firewall rules, or NSG rules that allow the Azure Site Recovery, Entra ID and Storage service tags), and wait for health to go back to Normal:

az network vnet subnet update --ids $v.'snet-web' --nat-gateway natgw-saat -o none
Start-Sleep -Seconds 900
az rest --method get --url "https://management.azure.com/subscriptions/$sub/resourceGroups/rg-saat-dr/providers/Microsoft.RecoveryServices/vaults/rsv-saat-dr/replicationProtectedItems?api-version=2023-08-01" --query "value[].{vm:properties.friendlyName, health:properties.replicationHealth, state:properties.protectionStateDescription, testFailover:properties.testFailoverStateDescription}" -o table

Health should now be back to Normal. Set up an Azure Monitor alert on replication health so you don’t find out about this in the middle of a disaster.

2Break it: the drill nobody cleaned up

Run another test failover (step 3) and then “forget” the cleanup, which teams often do after a drill goes well. Now look at what’s running in South India:

az vm list --resource-group rg-saat-dr --query "[].{name:name, size:hardwareProfile.vmSize, power:powerState}" --show-details -o table
az rest --method get --url "https://management.azure.com/subscriptions/$sub/resourceGroups/rg-saat-dr/providers/Microsoft.RecoveryServices/vaults/rsv-saat-dr/replicationProtectedItems?api-version=2023-08-01" --query "value[].{vm:properties.friendlyName, health:properties.replicationHealth, state:properties.protectionStateDescription, testFailover:properties.testFailoverStateDescription}" -o table

You should see something like this:

Name        Size              Power
----------  ----------------  ----------
web01-test  Standard_B2ats_v2  VM running
Vm     Health    State      TestFailover
-----  --------  ---------  ------------------------
web01  Warning   Protected  Waiting for cleanup

That test VM bills every hour, the item shows a warning, and ASR won’t start the next test failover until this one is cleaned up. Usually someone stumbles on a “web01-test” VM weeks later and nobody remembers what it’s for.

To fix it, run Cleanup test failover as in step 4, and add the cleanup to your drill checklist. Then tear the lab down:

  1. In the vault, go to Replicated items, open web01 and choose Disable replication, which removes the replica disks and the mobility extension.
  2. Delete the cache storage account ASR created in Central India. Its name ends in “asrcache”; you can find it with the first command below and delete it with az storage account delete.
az storage account list --query "[?contains(name, 'asrcache')].{name:name, group:resourceGroup}" -o table
az group delete --name rg-saat-dr --yes
az network vnet subnet update --ids $v.'snet-web' --remove natGateway -o none
az network nat gateway delete --resource-group rg-saat-core --name natgw-saat
az network public-ip delete --resource-group rg-saat-core --name pip-saat-natgw
az vm deallocate --resource-group rg-saat-vms --name web01
C:\azure-lab\Find-LabResources.ps1 -Lesson 39

After you delete the cache account the list shows, the last command prints this:

Nothing tagged course=saatvedha-azure is left.
Azure Site Recovery problems: critical health and an uncleaned test
So replication stalls when there’s no outbound access, and a forgotten test VM keeps running and billing.

✅ Checkpoint: You caught replication going Critical and a test failover left running, and removed every DR resource.

This happened at work

The DR test that passed every year

An insurer had 80 VMs replicating to its paired region with ASR and ran a test failover every year for the auditors, and the test always passed. Then a real regional networking incident forced them to fail over the claims system.

The VMs came up fine in the DR region, but the claims app couldn’t reach its database. The recovery plan had started the app before the database was ready, and DNS in the DR VNet was still pointing at the primary addresses. When they looked back, the annual test had only ever checked that the VMs booted, never that the app worked.

What they changed: recovery plans now start VMs in groups (database, app, web) with scripts that update DNS, and every test failover finishes with a scripted smoke test of real transactions in the isolated network. Replication health and RPO have alerts on them, and the drill checklist ends with cleanup and a written report.

Common mistakes and troubleshooting

MistakeWhat you seeWhat to do
VM can’t reach ASR endpointsReplication health Critical; RPO growsAllow outbound via NAT, firewall or service tags.
Testing into the production DR VNetIP clashes, test traffic hits real systemsAlways use an isolated test VNet.
Leaving test failovers runningTest VMs bill; next test blockedClean up as the last step of every drill.
Only checking that VMs bootApp fails in a real failoverSmoke-test the app in the test network.
No target-region quotaFailover fails to create VMsCheck vCPU quota in the target region.
Vault in the source regionCan’t select it for replicationCreate the vault in the target region.

Interview questions

Click a question to open it. Each one is worded the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. What is Azure Site Recovery?

Why they ask this: To check the basic concept.

How you might answer: It’s a disaster recovery service that keeps replicating VMs to another Azure region, or from on-premises into Azure, so you can start them there if the primary site fails.

2. What is the difference between Azure Backup and Site Recovery?

Why they ask this: A classic comparison.

How you might answer: Backup keeps restore points so you can go back in time after data loss, and its RPO is in hours. Site Recovery keeps a near-live copy in another region so you can get the service back quickly after a site failure, with an RPO of minutes.

3. What is a test failover?

Why they ask this: They want to see you know it’s safe.

How you might answer: It’s a failover into an isolated network. ASR creates a copy of the VM from a recovery point while replication and production carry on as normal, you test, and then you clean it up.

2–5 years experience

4. Replication health for a VM went Critical. What do you check?

Why they ask this: A day-to-day ticket.

How you might answer: I’d read the error details on the replicated item first, then check outbound connectivity from the VM to Site Recovery, Entra ID and the storage endpoints. After that, the mobility service extension status, disk churn limits, and whether anyone made a network or firewall change recently.

5. What do RPO and RTO mean for Site Recovery?

Why they ask this: They want the terms used correctly.

How you might answer: RPO is how much data you can afford to lose, and you see it as the age of the latest recovery point, often minutes. RTO is how long it takes to be up and running again, which depends on your recovery plans, VM start-up and app checks.

6. How do you fail back after a real failover?

Why they ask this: They want the full cycle.

How you might answer: You commit the failover and re-protect so it replicates from the DR region back to the primary. Once the primary is healthy you do a planned failover back, and then re-protect again in the original direction.

Senior level

7. How would you design DR for a three-tier app with ASR?

Why they ask this: They want orchestration.

How you might answer: I’d build one recovery plan with groups for database, app and web, add scripts or runbooks for DNS and connection strings, and have the networking already created in the DR region. Then regular test failovers with automated smoke tests. The databases might use their own replication rather than ASR.

8. How do you prove DR readiness to auditors?

Why they ask this: They want evidence.

How you might answer: I’d show scheduled test failovers with reports on the RPO achieved, the time to recover, smoke test results and cleanup. Along with that, alerts and dashboards for replication health, and a written runbook that matches the recovery plans.

9. What are common reasons a real failover fails even though tests passed?

Why they ask this: They want experience.

How you might answer: In my experience it’s things like target-region quota, or dependencies outside the replicated VMs such as DNS, identity or licences. Differences in networking between the test and DR VNets catch people too, and so do data stores replicated some other way that have fallen behind or broken.

Quick quiz

Q1. Where must the Recovery Services vault for ASR be?

  1. Source region
  2. Target region
  3. Any region
  4. No vault needed
Show answer

B — The vault lives in the target region.

Q2. Which network should a test failover use?

  1. Production VNet
  2. An isolated test VNet
  3. The internet
  4. The hub VNet
Show answer

B — Isolation keeps tests away from production.

Q3. Health is Critical but state says Protected. Meaning?

  1. All good
  2. Replication has stopped making progress
  3. The VM is deleted
  4. The vault is full
Show answer

B — Recovery points are getting old.

Q4. For how long does a new protected instance have no ASR charge?

  1. 7 days
  2. 31 days
  3. 90 days
  4. Always
Show answer

B — The first 31 days per instance; storage still bills.

Q5. What must you do after a successful test failover?

  1. Nothing
  2. Cleanup test failover
  3. Delete the vault
  4. Rotate keys
Show answer

B — Cleanup removes the test VM and allows the next test.

Quick recap

You can now set up regional DR for a VM and prove that it works.

  • ASR replicates disks continuously to another region.
  • The vault lives in the target region.
  • The VM needs outbound access to ASR, Entra ID and the cache account.
  • Test failover into an isolated VNet, then clean up.
  • Watch replication health and RPO, and don’t rely on the Protected state alone.

Next lesson

Lesson 40: Azure Arc-enabled servers → You connect a server outside Azure to Azure Arc and manage it like an Azure VM.

Further reading: Azure Site Recovery

Want to go deeper into Azure Site Recovery? See Microsoft’s Azure to Azure disaster recovery architecture and Run a disaster recovery drill to another region. You can also see the full plan for this course on the Azure Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.