Azure Site Recovery Overview

Azure Site Recovery (ASR) is Microsoft’s disaster recovery as a service (DRaaS) solution that replicates on-premises workloads — including physical Windows Server 2022 machines, Hyper-V VMs, and VMware VMs — to Microsoft Azure. In the event of a site failure, ASR enables failover to Azure within minutes, keeping your applications available without requiring a secondary physical datacenter. Once the on-premises site is restored, ASR supports failback to bring workloads home.

ASR integrates tightly with Azure Recovery Services Vault and supports replication for both Windows and Linux workloads. For Windows Server 2022, ASR can replicate entire VMs (Hyper-V or VMware) or physical servers, maintaining application-consistent recovery points and allowing test failovers that do not interrupt production replication.

Prerequisites

Before configuring ASR for Windows Server 2022, ensure the following are in place:

Azure subscription: A valid Azure subscription with sufficient quotas for the target VM size, storage account, and virtual network in the failover region. You must have Contributor or Site Recovery Contributor RBAC role on the Recovery Services Vault resource group.

Recovery Services Vault: Created in a different Azure region from your primary region. For example, if your on-premises site is in East US, create the vault in West US 2.

Network connectivity: The on-premises environment must have outbound HTTPS connectivity to Azure ASR endpoints. For corporate proxies, ASR supports proxy configuration in the Mobility Service and Configuration Server settings. Required URLs include *.hypervrecoverymanager.windowsazure.com, *.blob.core.windows.net, and *.accesscontrol.windows.net.

Source machine requirements: Windows Server 2022 VMs or physical servers. Disk sizes must not exceed ASR limits (currently 32 TB per disk). Dynamic disks are not supported for replication.

Creating a Recovery Services Vault

Use the Azure portal or Azure PowerShell to create the Recovery Services Vault:

# Login to Azure
Connect-AzAccount

# Create a resource group for the vault
New-AzResourceGroup -Name "rg-asr-vault" -Location "West US 2"

# Create the Recovery Services Vault
New-AzRecoveryServicesVault `
    -Name "vault-prod-asr" `
    -ResourceGroupName "rg-asr-vault" `
    -Location "West US 2"

# Set the vault context for subsequent operations
$vault = Get-AzRecoveryServicesVault -Name "vault-prod-asr"
Set-AzRecoveryServicesAsrVaultContext -Vault $vault

Set the vault’s replication redundancy to geo-redundant storage (GRS) for maximum durability:

Set-AzRecoveryServicesBackupProperty `
    -Vault $vault `
    -BackupStorageRedundancy GeoRedundant

Setting Up the VMware Configuration Server

For VMware-based replication, ASR requires an on-premises Configuration Server — a Windows Server machine (2012 R2 or later) that acts as the bridge between your vSphere environment and Azure. The Configuration Server runs the ASR mobility service installer, process server, and master target services.

Download the Configuration Server Unified Setup from the Azure portal (Recovery Services Vault > Site Recovery > Prepare Infrastructure > Source > Download). The installer requires:

  • 16 GB RAM minimum, 8 vCPUs
  • 600 GB free disk (300 GB for OS, 300 GB for cache)
  • Static IP address on the management network
  • Windows Server 2012 R2 or later (not the same machine you are protecting)

Run the Unified Setup installer, select Install the Configuration Server and Process Server, and connect to your Recovery Services Vault using the vault registration key downloaded from the Azure portal.

After installation, verify the Configuration Server appears in the vault:

Get-AzRecoveryServicesAsrFabric | Get-AzRecoveryServicesAsrServicesProvider

Setting Up Hyper-V Site Replication

For Hyper-V-hosted VMs (with or without System Center VMM), the process differs. You create a Hyper-V Site in the vault and install the Azure Site Recovery Provider on each Hyper-V host:

# Create a Hyper-V fabric (site) in the vault
$fabricSettings = New-AzRecoveryServicesAsrFabricDefinitionObject `
    -HyperVSite -Name "HyperVSite-Prod"

$fabricJob = New-AzRecoveryServicesAsrFabric -CreateSiteFabric -CreateSiteDetails $fabricSettings
Get-AzRecoveryServicesAsrJob -Job $fabricJob | Wait-AzRecoveryServicesAsrJob

On each Hyper-V host (Windows Server 2022), download and install the ASR Provider from the Azure portal. During installation, register the host with the vault using the downloaded registration key. After registration, the Hyper-V host appears under the Hyper-V site in the vault.

Installing the Mobility Service Agent on Windows Server 2022

For VMware VMs and physical Windows Server 2022 machines, the ASR Mobility Service agent must be installed on each machine to be replicated. This agent captures writes on the source machine and sends them to the Process Server, which forwards them to Azure.

The agent can be pushed automatically from the Configuration Server (requiring admin credentials to the target machine) or installed manually. For manual installation on Windows Server 2022, copy the installer from the Configuration Server:

# From the Configuration Server, the installer is located at:
# C:ProgramDataASRhomesvsystemspushinstallsvcrepository

# On the target Windows Server 2022 machine, run:
.MicrosoftAzureSiteRecoveryUnifiedAgentInstaller.exe /Role "MS" /Silent /Platform VmWare

After installation, register the agent with the Configuration Server by specifying its IP address and the passphrase generated during Configuration Server setup:

cd "C:Program Files (x86)Microsoft Azure Site Recoveryagent"

.UnifiedAgentConfigurator.exe `
    /CSEndPoint 192.168.1.50 `
    /PassphraseFilePath C:asrpassphrase.txt

Configuring a Replication Policy

A replication policy defines the Recovery Point Objective (RPO) threshold, application-consistent snapshot frequency, and recovery point retention period. Create a policy via PowerShell:

$policyJob = New-AzRecoveryServicesAsrPolicy `
    -Name "Policy-WS2022-30days" `
    -ReplicationProvider HyperVReplicaAzure `
    -ReplicationFrequencyInSeconds 300 `
    -RecoveryPoints 30 `
    -ApplicationConsistentSnapshotFrequencyInHours 4 `
    -RecoveryAzureStorageAccountId "/subscriptions//resourceGroups/rg-asr/providers/Microsoft.Storage/storageAccounts/asrstorageprod"

Get-AzRecoveryServicesAsrJob -Job $policyJob | Wait-AzRecoveryServicesAsrJob

Key parameters: -ReplicationFrequencyInSeconds sets the replication cadence (300 seconds = 5 minutes is common). -RecoveryPoints sets how many days of recovery points to retain. -ApplicationConsistentSnapshotFrequencyInHours controls VSS-consistent snapshot frequency — VSS snapshots ensure that in-flight transactions are committed before the snapshot, guaranteeing application consistency for SQL Server, Exchange, etc.

Enabling Replication for a Windows Server 2022 VM

Once the source fabric, policy, and Protection Container are configured, enable replication for individual VMs. The following PowerShell example enables replication for a Hyper-V VM:

# Get the protection container and policy
$protectionContainer = Get-AzRecoveryServicesAsrProtectionContainer `
    -Fabric (Get-AzRecoveryServicesAsrFabric -Name "HyperVSite-Prod")

$policy = Get-AzRecoveryServicesAsrPolicy -Name "Policy-WS2022-30days"

# Associate the policy with the protection container
$mappingJob = New-AzRecoveryServicesAsrProtectionContainerMapping `
    -Name "ContainerMapping-Prod" `
    -Policy $policy `
    -PrimaryProtectionContainer $protectionContainer

Get-AzRecoveryServicesAsrJob -Job $mappingJob | Wait-AzRecoveryServicesAsrJob

# Enable replication for a specific VM
$protectableItem = Get-AzRecoveryServicesAsrProtectableItem `
    -ProtectionContainer $protectionContainer `
    -FriendlyName "WS2022-AppServer01"

$replicationJob = New-AzRecoveryServicesAsrReplicationProtectedItem `
    -HyperVToAzure `
    -ProtectableItem $protectableItem `
    -Name "RP-WS2022-AppServer01" `
    -ProtectionContainerMapping $mappingJob.JobData `
    -RecoveryAzureNetworkId "/subscriptions//resourceGroups/rg-dr/providers/Microsoft.Network/virtualNetworks/vnet-dr" `
    -RecoveryAzureSubnetName "subnet-dr" `
    -RecoveryResourceGroupId "/subscriptions//resourceGroups/rg-dr"

After enabling replication, initial sync (IRSync) begins. This can take several hours depending on disk size and network bandwidth. Monitor progress:

Get-AzRecoveryServicesAsrReplicationProtectedItem `
    -ProtectionContainer $protectionContainer | 
    Select-Object FriendlyName, ReplicationHealth, ProtectionState

Test Failover Procedure

A test failover creates a copy of the protected VM in an isolated Azure VNet without interrupting production replication. This is used to validate that the VM boots correctly in Azure and that applications function as expected.

$recoveryPoint = Get-AzRecoveryServicesAsrRecoveryPoint `
    -ReplicationProtectedItem (Get-AzRecoveryServicesAsrReplicationProtectedItem -Name "RP-WS2022-AppServer01" -ProtectionContainer $protectionContainer) |
    Sort-Object RecoveryPointTime -Descending |
    Select-Object -First 1

$testFailoverJob = Start-AzRecoveryServicesAsrTestFailoverJob `
    -ReplicationProtectedItem (Get-AzRecoveryServicesAsrReplicationProtectedItem -Name "RP-WS2022-AppServer01" -ProtectionContainer $protectionContainer) `
    -Direction PrimaryToRecovery `
    -AzureVMNetworkId "/subscriptions//resourceGroups/rg-dr/providers/Microsoft.Network/virtualNetworks/vnet-isolated" `
    -RecoveryPoint $recoveryPoint

After testing, clean up the test failover VM:

Start-AzRecoveryServicesAsrTestFailoverCleanupJob `
    -ReplicationProtectedItem (Get-AzRecoveryServicesAsrReplicationProtectedItem -Name "RP-WS2022-AppServer01" -ProtectionContainer $protectionContainer) `
    -Comment "Test completed successfully"

Actual Failover and Failback

In a real disaster, trigger a planned or unplanned failover. A planned failover (for scheduled maintenance) syncs final changes before cutting over, minimising data loss. An unplanned failover is used when the primary site is already down:

# Unplanned failover to Azure (primary site is down)
Start-AzRecoveryServicesAsrUnplannedFailoverJob `
    -ReplicationProtectedItem (Get-AzRecoveryServicesAsrReplicationProtectedItem -Name "RP-WS2022-AppServer01" -ProtectionContainer $protectionContainer) `
    -Direction PrimaryToRecovery

After the primary site is restored, reprotect the failed-over VM to begin reverse replication from Azure back to on-premises:

Update-AzRecoveryServicesAsrProtectionDirection `
    -ReplicationProtectedItem $rpi `
    -Direction RecoveryToPrimary `
    -FailbackToHyperVHost "hypervhost01.corp.local"

Once replication is healthy from Azure to on-premises, perform a planned failover in the RecoveryToPrimary direction to complete the failback, then reprotect again in the PrimaryToRecovery direction to resume normal DR replication.