Install Azure Site Recovery Provider on Azure Stack HCI OS

5 Min. Read

In this article, I will share with you how to install and register the Azure Site Recovery Provider (agent) on Azure Stack HCI OS and Windows Server Hyper-V Core operating systems.

Introduction

Azure Site Recovery (ASR) is Microsoft’s Disaster Recovery (DR) strategy. It keeps workloads safe and recoverable through replication from on-premises servers, such as physical servers, Azure Stack HCI, Hyper-V VMs, and VMware-based VMs. You can also replicate VMs between different Azure datacenters in case of a region outage. Although ASR is designed for disaster recovery, you can also use Azure Migrate by leveraging the Azure Site Recovery Provider to migrate virtual machines to the cloud an approach known as “Lift and Shift“.

So what is the difference between both scenarios?

  • In disaster recovery, you replicate machines on a regular basis to Azure. When an outage occurs on-premises or in one of the Azure datacenter, you can fail the machines over from the primary site to the secondary Azure site, and access them from there. When the primary site is available again, you can failback.
  • In migration, you replicate on-premises (physical/virtual) machines to Azure. Then you failover from on-premises to Azure and complete the migration process. There’s no failback involved. The key feature of the migration scenario is, ASR will convert automatically all your (VHDX) on-premises to (VHD) and upload them to Azure Blob Storage.

Azure Stack HCI is a new hyper-converged infrastructure (HCI) operating system delivered as an Azure service that provides the latest security, performance, and feature updates. You can deploy and run Windows and Linux virtual machines (VMs) in your data center or at the edge using your existing tools, processes, and skillsets. Additionally, you can extend your data center to the cloud with Azure Backup, Azure Monitor, Azure Security Center, and much more…

Microsoft has pushed the IT Pros into Server Core strenuously and Azure Stack HCI OS does not include desktop experience, because server Core’s smaller footprint comes with a smaller attack surface, making it less vulnerable than the server with desktop experience option.

The primary management tool and hybrid integration for Azure Stack HCI and Windows Server Core is Windows Admin Center. I was recently evaluating the new Azure Stack HCI OS with Azure Site Recovery in Windows Admin Center, and I couldn’t set up VM Protection as shown in the figure below. Before you ask, yes, I have tried Google Chrome and Microsoft Edge browsers, and still the same issue. This looks like a bug.

Windows Admin Center Couldn't set up VM Protection

Behind the scene, Windows Admin Center will automatically install the latest ASR agent onto the Hyper-V host or Azure Stack HCI nodes (in the case of a Hyper-Converged cluster), the best part of it that the agent installation does NOT trigger a reboot of the nodes, this will also register the host on-premises with the Azure Site Recovery service.

Microsoft streamlined the deployment of Azure Site Recovery in Windows Admin Center to make that process easier. Check the following step-by-step guide to learn more about how to protect Hyper-V virtual machines with Azure Site Recovery using Windows Admin Center.

So what to do in this case? Open support case, or troubleshoot…

Well, there is a better approach…

In this article, I will show you how to install and automate the registration of Azure Site Recovery Provider (agent) on Azure Stack HCI and Windows Server Hyper-V operating systems without using Windows Admin Center.

Prerequisites

The prerequisites are very simple as follows:

  1. The target servers hosting the VMs you want to protect must have Internet access to replicate to Azure. This includes Azure Stack HCI OS and Windows Server Hyper-V OS.
  2. Make sure you have an active Azure subscription. If you don’t have a subscription, you can create a free one here.
  3. Azure Stack HCI cluster or Windows Server Hyper-V cluster up and running (Minimum of 2 servers, maximum of 16 servers).
  4. Azure Recovery Services Vaults. If you don’t have a recovery services vault, you can follow the instructions described here.
    • Open Site Recovery infrastructure blade under Manage section and then create/add a Hyper-V site under Hyper-V Sites.
    • Once the Hyper-V site is created, browse to the Hyper-V Hosts page and then click +Server. You need to download the vault registration key (Vault Credentials) to register the host/HCI cluster in a Hyper-V site (more on this in a bit).
  5. Last, you need to have PowerShell over WinRM enabled on your nodes.

Download Azure Site Recovery Provider

In this step, we will download the latest Azure Site Recovery Provider agent and extract its content by running the following PowerShell commands:

Invoke-WebRequest -Uri http://aka.ms/downloaddra_we -OutFile "AzureSiteRecoveryProvider.exe" 
Start-process ".\AzureSiteRecoveryProvider.exe" -ArgumentList '/x:C:\ASR /q' -Wait

Install Azure Site Recovery Provider

In this step, we will install the provider on Azure Stack HCI OS nodes or s. To automate this process, I will use the following PowerShell commands which will copy the bits to each node first and then install the provider.

$nodes = "AZSHCINODE01", "AZSHCINODE02", "AZSHCINODE03", "AZSHCINODE04"
foreach ($node in $nodes) { 
Copy-Item –Path C:\ASR –Destination "\\$($node)\c$" -Force -Recurse
}
Invoke-Command -ComputerName $nodes -ScriptBlock { Start-process "C:\ASR\SETUPDR.EXE" -ArgumentList '/i /q' -Wait }

You can verify that the Azure site recovery agent was successfully installed by running the following commands:

$nodes = "AZSHCINODE01", "AZSHCINODE02", "AZSHCINODE03", "AZSHCINODE04"
Invoke-Command -ComputerName $nodes -ScriptBlock { 
$results = Get-content "C:\ProgramData\ASRLogs\DRSetupWrapper.log" | Select-String 'Azure site recovery was' | Out-String
Write-Output "$($env:computername):$results" 
}

Azure site recovery was successfully installed

Register Azure Site Recovery Provider

After successful installation of the Azure Site Recovery provider, the final step is to register Azure Site Recovery Provider with the target Recovery Services Vault on every node of Azure Stack HCI / Hyper-V Server Core.

Assuming you have already downloaded the Vault Credentials file on your machine under the C:\ drive, you can copy it to every node using the following PowerShell command:

$nodes = "AZSHCINODE01", "AZSHCINODE02", "AZSHCINODE03", "AZSHCINODE04"
Get-Item -Path C:\*.VaultCredentials | Rename-Item -NewName azshci.VaultCredentials
foreach ($node in $nodes) {
Copy-Item –Path C:\azshci.VaultCredentials –Destination "\\$($node)\c$" -Force 
}

Once the vault credentials file is copied to every node, you can register the provider using the following PowerShell commands. After digging deeper, I was able to accomplish this challenging step using PowerShell remoting:

$nodes = "AZSHCINODE01", "AZSHCINODE02", "AZSHCINODE03", "AZSHCINODE04"
foreach ($node in $nodes) { 
Invoke-Command -ComputerName $node -ScriptBlock { 
Start-Process "C:\Program Files\Microsoft Azure Site Recovery Provider\DRConfigurator.exe" -ArgumentList "/R /Friendlyname $env:computername /Credentials C:\azshci.VaultCredentials" -Wait 
    }
}

After 5 minutes, switching back to the Azure Portal and I can confirm that all my Azure Stack HCI nodes are registered and reporting in Site Recovery Infrastructure | Hyper-V Hosts bade as shown in the figure below.

Site Recovery infrastructure | Hyper-V Hosts

Now with the Azure Site Recovery Provider installed on every node in the cluster and registered with the Recovery Services Vault, we can start the replication, and protecting our Virtual Machines to Azure using Windows Admin Center, right?

Replicate VM using Azure Site Recovery in Windows Admin Center

Unfortunately, this is not the case, Windows Admin Center still was not able to enable protection and replicate the VM from Azure Stack HCI to Azure as shown in the figure below.

Couldn't enable protection for virtual machine

 So what to do next then?

You create a replication policy directly from the Recovery Services vault in Azure and then associate the Hyper-V site to the policy.

Browse to Site Recovery Infrastructure | Replication Policies bade and click +Replication policy as shown in the figure below.

Site Recovery infrastructure | Replication policies

Finally, you enable replication from the Recovery Services vault in Azure under Protected items | Replicated items blade.

Azure Site Recovery Enable Replication

That’s it there you have it!

Summary

In this article, I showed you how to install and automate the registration of Azure Site Recovery Provider (agent) on Azure Stack HCI and Windows Server Hyper-V core operating systems without Windows Admin Center.

Windows Admin Center streamlines the process of replicating your virtual machines on your Hyper-V servers or clusters, making it easier to leverage the power of Azure from your own datacenter. To automate the setup, you can connect the Windows Admin Center gateway to Azure as described in the following guide.

Until the issue is fixed in the Windows Admin Center Portal, we can automate it!

__
Thank you for reading my blog.

If you have any questions or feedback, please leave a comment.

-Charbel Nemnom-

Related Posts

Previous

Configure Cluster Quorum (Cloud Witness) Using Windows Admin Center

Audit Subnets That do not Have Network Security Group Associated

Next

6 thoughts on “Install Azure Site Recovery Provider on Azure Stack HCI OS”

Leave a comment...

  1. Thanks Charbel – this one has been puzzling me for a while as I noticed the same errors in WAC when trying to enable ASR on AzSHCI OS – quick question, the account I am using to connect my cluster to azure cannot be a Global Admin, is assigning Site Recovery Contributor role enough permissions to allow ASR to be enabled?

  2. Thank you Colin for your comment!
    Yes, you don’t need to have a Global Admin to enable Azure Site Recovery.
    Site Recovery Contributor is enough – This role has all permissions required to manage Azure Site Recovery operations in a Recovery Services vault. However, a user with this role can’t create or delete a Recovery Services vault or assign access rights to other users. This role is best suited for disaster recovery administrators who can enable and manage disaster recovery for applications or entire organizations.
    Hope this helps!

  3. Thanks Charbel – I was trying to enable ASR via WAC with those permissions assigned but still received errors, I have logged a ticket with MS and they believe there is something wrong backend with ASR enablement via WAC, which you have also highlighted.

    I will try and enable with the same account using your script and hopefully this will work.

    thanks

  4. Thank you, Colin! There is definitely a bug between WAC and ASR as of now. I used the Global Admin account and I received the same error.
    Let me know how it works for you after using those scripts.
    Thanks!

  5. Interesting issue here Charbel that I had previously whenever I tried enabling ASR via the WAC – ran through your scripts and all good but decided to reboot a node as previously I had seen issues after a restart.

    Once the node has been restarted I noticed that the Azure Stack HCI service would not start – do you have the same issue?

    I managed to get a fix for this via the Support Center and did request it be flagged as a bug but there still doesn’t seem to be a fix – happy to continue the conversation via email on this one.

  6. Thank you Colin for the update! I am happy to hear that the scripts have worked for you.
    No, I did not experience this issue after restarting my four Azure Stack HCI nodes.
    Hopefully, they will resolve this issue soon!

Let me know what you think, or ask a question...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Stay in Touch

Never miss out on your favorite posts and our latest announcements!

The content of this website is copyrighted from being plagiarized!

You can copy from the 'Code Blocks' in 'Black' by selecting the Code.

Please send your feedback to the author using this form for any 'Code' you like.

Thank you for visiting!