Replicate Hyper-V VMs in VMM clouds to a secondary site with Azure Site Recovery by using SAN
Use this article if you want to deploy Azure Site Recovery to manage replication of Hyper-V VMs (managed in System Center Virtual Machine Manager clouds) to a secondary VMM site, using Azure Site Recovery in the classic portal. This scenario isn't available in the new Azure portal.
Post any comments at the end of this article. Get answers to technical questions in the Azure Recovery Services Forum.
Why replicate with SAN and Site Recovery?
- SAN provides an enterprise-level, scalable replication solution so that a primary site containing Hyper-V with SAN can replicate LUNs to a secondary site with SAN. Storage is managed by VMM, and replication and failover is orchestrated with Site Recovery.
- Site Recovery has worked with several SAN storage partners to provide replication across Fibre Channel and iSCSI storage.
- Use your existing SAN infrastructure to protect mission-critical apps deployed in Hyper-V clusters. VMs can be replicated as a group so that N-tier apps can be failed over consistently.
- SAN replication ensures replication consistency across different tiers of an application with synchronized replication for low RTO and RPO, and asynchronized replication for high flexibility (depending on your storage array capabilities).
- You can manage SAN storage in the VMM fabric and use SMI-S in VMM to discover existing storage.
- Site-to-site replication with SAN isn't available in the Azure portal. It's only available in the classic portal. New vaults can't be created in the classic portal. Existing vaults can be maintained.
- Replication from SAN to Azure isn't supported.
- You can't replicate shared VHDXs, or logical units (LUNs) that are directly connected to VMs via iSCSI or Fibre Channel. Guest clusters can be replicated.
- Azure: Set up a Site Recovery vault in the Azure portal.
- SAN storage: SAN storage is managed in the VMM fabric. You add the storage provider, create storage classifications, and set up storage pools.
- VMM and Hyper-V: We recommend a VMM server in each site. Set up VMM private clouds, and place Hyper-V clusters in those clouds. During deployment, the Azure Site Recovery Provider is installed on each VMM server, and the server is registered in the vault. The Provider communicates with the Site Recovery service to manage replication, failover, and failback.
- Replication: After you set up storage in VMM and configure replication in Site Recovery, replication occurs between the primary and secondary SAN storage. No replication data is sent to Site Recovery.
- Failover: Enable failover in the Site Recovery portal. There is zero data loss during failover because replication is synchronous.
- Failback: To fail back, you enable reverse replication to transfer delta changes from the secondary site to the primary site. After reverse replication is complete, you run a planned failover from secondary to primary. This planned failover stops the replica VMs on the secondary site and starts them on the primary site.
Before you start
|Azure||You need a Microsoft Azure account. You can start with a free trial. Learn more about Site Recovery pricing. Create an Azure Site Recovery vault to configure and manage replication and failover.|
|VMM||You can use a single VMM server and replicate between different clouds, but we recommend one VMM in the primary site and one in the secondary site. A VMM can be deployed as a physical or virtual standalone server, or as a cluster.
The VMM server should be running System Center 2012 R2 or later with the latest cumulative updates.
You need at least one cloud configured on the primary VMM server you want to protect and one cloud configured on the secondary VMM server you want to use for failover.
The source cloud must contain one or more VMM host groups.
All VMM clouds must have the Hyper-V Capacity profile set.
For more about setting up VMM clouds, see Deploy a private VM cloud.
|Hyper-V||You need one or more Hyper-V clusters in primary and secondary VMM clouds.
The source Hyper-V cluster must contain one or more VMs.
The VMM host groups in the primary and secondary sites must contain at least one of the Hyper-V clusters.
The host and target Hyper-V servers must be running Windows Server 2012 or later with the Hyper-V role and the latest updates installed.
If you're running Hyper-V in a cluster and have a static IP address-based cluster, cluster broker isn't created automatically. You must configure it manually. For more information, see Preparing host clusters for Hyper-V replica.
|SAN storage||You can replicate guest-clustered virtual machines with iSCSI or channel storage, or by using shared virtual hard disks (vhdx).
You need two SAN arrays: one in the primary site, and one in the secondary site.
A network infrastructure should be set up between the arrays. Peering and replication should be configured. Replication licenses should be set up in accordance with the storage array requirements.
Set up networking between the Hyper-V host servers and the storage array so that hosts can communicate with storage LUNs by using iSCSI or Fibre Channel.
Check supported storage arrays.
SMI-S providers from storage array manufacturers should be installed, and the SAN arrays should be managed by the provider. Set up the Provider according to manufacturer instructions.
Make sure that the array's SMI-S provider is on a server that the VMM server can access over the network with an IP address or FQDN.
Each SAN array should have one or more available storage pools.
The primary VMM server should manage the primary array, and the secondary VMM server should manage the secondary array.
|Network mapping||Set up network mapping so that replicated virtual machines are optimally placed on secondary Hyper-V host servers after failover, and so that they're connected to appropriate VM networks. If you don't configure network mapping, replica VMs won't be connected to any network after failover.
Make sure that VMM networks are configured correctly so that you can set up network mapping during Site Recovery deployment. In VMM, the VMs on the source Hyper-V host should be connected to a VMM VM network. That network should be linked to a logical network that is associated with the cloud.
The target cloud should have a corresponding VM network, and it in turn should be linked to a corresponding logical network that is associated with the target cloud.
Step 1: Prepare the VMM infrastructure
To prepare your VMM infrastructure, you need to:
- Verify VMM clouds.
- Integrate and classify SAN storage in VMM.
- Create LUNs and allocate storage.
- Create replication groups.
- Set up VM networks.
Verify VMM clouds
Make sure your VMM clouds are set up properly before you begin Site Recovery deployment.
Integrate and classify SAN storage in the VMM fabric
- In the VMM console, go to Fabric > Storage > Add Resources > Storage Devices.
In the Add Storage Devices wizard, select Select a storage provider type and select SAN and NAS devices discovered and managed by an SMI-S provider.
On the Specify Protocol and Address of the Storage SMI-S Provider page, select SMI-S CIMXML and specify the settings for connecting to the provider.
In Provider IP address or FQDN and TCP/IP port, specify the settings for connecting to the provider. You can use an SSL connection for SMI-S CIMXML only.
- In Run as account, specify a VMM Run As account that can access the provider, or create an account.
On the Gather Information page, VMM automatically tries to discover and import the storage device information. To retry discovery, click Scan Provider. If the discovery process succeeds, the discovered storage arrays, storage pools, manufacturer, model, and capacity are listed on the page.
In Select storage pools to place under management and assign a classification, select the storage pools that VMM will manage and assign them a classification. LUN information is imported from the storage pools. Create LUNs based on the applications you need to protect, their capacity requirements, and your requirements for what needs to replicate together.
Create LUNs and allocate storage
Create LUNs based on the applications you need to protect, capacity requirements, and your requirements for what needs to replicate together.
After the storage appears in the VMM fabric, you can provision LUNs.
Don't add VHDs for the VM that are enabled for replication to LUNs. If those LUNs aren't in a Site Recovery replication group, they won't be detected by Site Recovery.
Allocate storage capacity to the Hyper-V host cluster so that VMM can deploy virtual machine data to the provisioned storage:
- Before allocating storage to the cluster, you need to allocate it to the VMM host group on which the cluster resides. For more information, see How to allocate storage logical units to a host group in VMM and How to allocate storage pools to a host group in VMM.
Allocate storage capacity to the cluster as described in How to configure storage on a Hyper-V host cluster in VMM.
In Specify Protocol and Address of the Storage SMI-S Provider, select SMI-S CIMXML. Specify the settings for connecting to the provider. You can use an SSL connection only for SMI-S CIMXML.
- In Run as account, specify a VMM Run As account that can access the provider, or create an account.
In Gather Information, VMM automatically tries to discover and import the storage device information. If you need to retry, click Scan Provider. When the discovery process succeeds, the storage arrays, storage pools, manufacturer, model, and capacity are listed on the page.
In Select storage pools to place under management and assign a classification, select the storage pools that VMM will manage, and assign them a classification. LUN information is imported from the storage pools.
Create replication groups
Create a replication group that includes all the LUNs that will need to replicate together.
- In the VMM console, open the Replication Groups tab of the storage array properties, and then click New.
Create the replication group.
Set up networks
If you want to configure network mapping, do the following:
- See Site Recovery network mapping.
Prepare VM networks in VMM:
Step 2: Create a vault
- Sign in to the Azure portal from the VMM server you want to register in the vault.
- Expand Data Services > Recovery Services, and then click Site Recovery Vault.
- Click Create New > Quick Create.
- In Name, enter a friendly name to identify the vault.
- In Region, select the geographic region for the vault. To check supported regions, see Azure Site Recovery Pricing Details.
Click Create vault.
Check the status bar to confirm that the vault was successfully created. The vault will be listed as Active on the main Recovery Services page.
Register the VMM servers
Open the Quick Start page from the Recovery Services page. Quick Start can also be opened at any time by choosing the icon.
In the drop-down box, select Between Hyper-V on-premises site using array replication.
- In Prepare VMM servers, download the latest version of the Azure Site Recovery Provider installation file.
- Run this file on the source VMM server. If VMM is deployed in a cluster and you're installing the Provider for the first time, install the Provider on an active node and finish the installation to register the VMM server in the vault. Then install the Provider on the other nodes. If you're upgrading the Provider, you need to upgrade on all nodes so that they have the same Provider version.
- The installer checks requirements and requests permission to stop the VMM service to begin Provider setup. The service will be restarted automatically when setup finishes. On a VMM cluster, you'll be prompted to stop the Cluster role.
In Microsoft Update, you can opt in for updates, and Provider updates will be installed according to your Microsoft Update policy.
By default, the install location for the Provider is
\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin. Click Install to begin.
After the Provider is installed, click Register to register the VMM server in the vault.
In Internet Connection, specify how the Provider connects to the Internet. Select Use default system proxy settings if you want to use the default Internet connection settings on the server.
- If you want to use a custom proxy, set it up before you install the Provider. When you configure custom proxy settings, a test runs to check the proxy connection.
- If you do use a custom proxy, or if your default proxy requires authentication, you should enter the proxy details, including the address and port.
- The required URLs should be accessible from the VMM server.
- If you use a custom proxy, a VMM Run As account (DRAProxyAccount) is created automatically by using the specified proxy credentials. Configure the proxy server so that this account can authenticate. You can modify the Run As account settings in the VMM console (Settings > Security > Run As Accounts > DRAProxyAccount). You must restart the VMM service for the change to take effect.
- In Registration Key, select the key that you downloaded from the portal and copied to the VMM server.
In Vault name, verify the name of the vault in which the server will be registered.
The encryption setting is only used for VMM to Azure replication. You can ignore it.
- In Server name, specify a friendly name to identify the VMM server in the vault. In a cluster configuration, specify the VMM cluster role name.
In Initial cloud metadata sync, select whether you want to synchronize metadata for all clouds on the VMM server. This action only needs to happen once on each server. If you don't want to synchronize all clouds, you can leave this setting unchecked and synchronize each cloud individually in the cloud properties in the VMM console.
Click Next to complete the process. After registration, metadata from the VMM server is retrieved by Azure Site Recovery. The server is displayed in Servers > VMM Servers in the vault.
The Azure Site Recovery Provider can also be installed by using the following command line. This method can be used to install the provider on Server Core for Windows Server 2012 R2.
- Download the Provider installation file and registration key to a folder. For example, C:\ASR.
- Stop the VMM service.
Extract the Provider installer. Run these commands as an administrator:
C:\Windows\System32> CD C:\ASR C:\ASR> AzureSiteRecoveryProvider.exe /x:. /q
Install the Provider:
C:\ASR> setupdr.exe /i
Register the Provider:
CD C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin\> DRConfigurator.exe /r /Friendlyname <friendly name of the server> /Credentials <path of the credentials file> /EncryptionEnabled <full file name to save the encryption certificate>
- /Credentials: Required parameter for the location in which the registration key file is located.
- /FriendlyName: Required parameter for the name of the Hyper-V host server that appears in the Azure Site Recovery portal.
- /EncryptionEnabled: Optional parameter only used when replicating from VMM to Azure.
- /proxyAddress: Optional parameter that specifies the address of the proxy server.
- /proxyport: Optional parameter that specifies the port of the proxy server.
- /proxyUsername: Optional parameter that specifies the proxy user name (if the proxy requires authentication).
- /proxyPassword: Optional parameter that specifies the password for authenticating with the proxy server (if the proxy requires authentication).
Step 3: Map storage arrays and pools
Map primary and secondary arrays to specify which secondary storage pool receives replication data from the primary pool. Map storage before you configure replication, because the mapping information is used when you enable protection for replication groups.
Before you start, check that VMM clouds appear in the vault. Clouds are detected either when you synchronize all clouds during Provider installation or when you synchronize a specific cloud in the VMM console.
Click Resources > Server Storage > Map Source and Target Arrays.
Select the storage arrays on the primary site, and map them to storage arrays on the secondary site. In Storage Pools, select a source and target storage pool to map.
Step 4: Configure replication settings
After VMM servers are registered, configure cloud protection settings.
- On the Quick Start page, click Set up protection for VMM clouds.
- On the Protected Items tab, select the cloud Configuration.
- In Target, select VMM.
- In Target location, select the VMM server that manages the cloud you want to use for recovery.
- In Target cloud, select the target cloud you want to use for VM failover.
- We recommend that you select a target cloud that meets recovery requirements for the virtual machines you protect.
- A cloud can only belong to a single cloud pair--as either a primary or a target cloud.
- Site Recovery verifies that clouds have access to SAN storage, and that the storage arrays are mapped.
- If verification is successful, in Replication type, select SAN.
After you save the settings, a job is created that can be monitored on the Jobs tab. Settings can be modified on the Configure tab. If you want to modify the target location or target cloud, you must remove the cloud configuration and then reconfigure the cloud.
Step 5: Enable network mapping
- On the Quick Start page, click Map networks.
- Select the source VMM server, and then select the target VMM server to which the networks will be mapped. The list of source networks and their associated target networks are displayed. A blank value is shown for networks that aren't mapped. Click the information icon next to the source and target network names to view the subnets for each network.
Select a network in Network on source, and then click Map. The service detects the VM networks on the target server and displays them.
Select one of the VM networks from the target VMM server.
When you select a target network, the protected clouds that use the source network are displayed. Available target networks are also displayed. We recommend that you select a target network that is available to all the clouds you're using for replication.
- Click the check mark to complete the mapping process. A job starts that tracks progress. You can view it on the Jobs tab.
Step 6: Enable replication for replication groups
Before you can enable protection for virtual machines, you need to enable replication for storage replication groups.
- On the Properties page of the primary cloud in the Site Recovery portal, open the Virtual Machines tab and click Add Replication Group.
- Select one or more VMM replication groups that are associated with the cloud, verify the source and target arrays, and specify the replication frequency.
Site Recovery, VMM, and the SMI-S providers provision the target site storage LUNs and enable storage replication. If the replication group is already replicated, Site Recovery reuses the existing replication relationship and updates the information.
Step 7: Enable protection for virtual machines
When a storage group is replicating, enable protection for VMs in the VMM console with one of the following methods:
- New virtual machine: When you create a VM, you enable replication and associate the VM with the replication group. With this option, VMM uses intelligent placement to optimally place the VM storage on the LUNs of the replication group. Site Recovery orchestrates the creation of a shadow VM on the secondary site and allocates capacity so that replica VMs can be started after failover.
- Existing virtual machine: If a virtual machine is already deployed in VMM, you can enable replication and perform a storage migration to a replication group. After completion, VMM and Site Recovery detect the new VM and start managing it in Site Recovery. A shadow VM is created on the secondary site, and capacity is allocated so that the replica VM can be started after failover.
After VMs are enabled for replication, they appear in the Site Recovery console. You can view VM properties, track status, and track failover replication groups that contain multiple VMs. In SAN replication, all VMs associated with a replication group must fail over together. This is because failover occurs at the storage layer first. It’s important to group your replication groups properly and place only associated VMs together.
After you've enabled replication for a VM, don't add its VHDs to LUNs unless they are located in a Site Recovery replication group. VHDs will only be detected by Site Recovery if they are located in a Site Recovery replication group.
You can track progress, including the initial replication, on the Jobs tab. After the Finalize Protection job runs, the virtual machine is ready for failover.
Step 8: Test the deployment
Test your deployment to make sure that VMs fail over as expected. To do this, create a recovery plan and run a test failover.
- On the Recovery Plans tab, click Create Recovery Plan.
Specify a name for the recovery plan, and select source and target VMM servers. The source server must have VMs that are enabled for failover and recovery. Select SAN to view only clouds that are configured for SAN replication.
In Select Virtual Machines, select replication groups. All VMs associated with the group are added to the recovery plan. These VMs are added to the recovery plan default group (Group 1). You can add more groups if necessary. After replication, VMs are numbered according to the order of the recovery plan groups.
- After the recovery plan is created, it appears in the list on the Recovery Plans tab. Select the plan and choose Test Failover.
On the Confirm Test Failover page, select None. With this option enabled, the failed over replica VMs won't be connected to any network. This tests that the VMs fail over as expected, but it doesn't test the network environment. For more about other networking options, see Site Recovery failover.
The test VM is created on the same host as the host on which the replica VM exists. It isn’t added to the cloud in which the replica VM is located.
- After replication, the replica VM will have a different IP address than the primary virtual machine. If you're issuing addresses from DHCP, it will be updated automatically. If you're not using DHCP and you want the same addresses, you need to run a couple of scripts.
Run this script to retrieve the IP address:
$vm = Get-SCVirtualMachine -Name <VM_NAME> $na = $vm.VirtualNetworkAdapters> $ip = Get-SCIPAddress -GrantToObjectID $na.id $ip.address
Run this sample script to update DNS. Specify the IP address you retrieved.
[string]$Zone, [string]$name, [string]$IP ) $Record = Get-DnsServerResourceRecord -ZoneName $zone -Name $name $newrecord = $record.clone() $newrecord.RecordData.IPv4Address = $IP Set-DnsServerResourceRecord -zonename $zone -OldInputObject $record -NewInputObject $Newrecord
After you've run a test failover to check that your environment is working as expected, see Site Recovery failover to learn about different types of failovers.