This is a follow up post to accompany my previous post Azure Site Recovery – From Start to Finish. In that post, I demonstrate how you can go from a new shiny Azure subscription to fully protecting your VMware infrastructure and your physical servers using Azure Site Recovery. When I wrote the previous post (I use Word for blog posts) it was 32 pages, it contains a lot of detail on the process and tons of insight. This is the skinny version of that post. It is a PowerShell script hosted on GitHub that automates the steps for you. So instead of going through the article and doing something like this each time

In the Azure console:

  • Click Recovery Services vaults > vault.
  • In the Resource Menu, click Site Recovery > Prepare Infrastructure > Protection goal.
  • In Protection goal, select To Azure > Yes, with VMware vSphere Hypervisor.
  • Click > Source

 

You can instead do this.

Of course, it isn’t actually that easy. You must open PowerShell first, then run the script. I kid, there is more that you will have to customize in the script to make it work for you and I will walk through those next. First, I will walk through the PowerShell script. It may help make the process a bit more clear when reading the longer article.

Here in this short code block I create the resource group, storage account, my Vnet and subnet, and the actual Recovery Services vault. Which really isn’t a lot of clicking in the console to get this done either but it still isn’t as efficient or as fast as PowerShell.

 

In the next section, I simply create the vault key and then import it into Azure.

In this final section of the script policies are created and then uploaded to Azure

Additional Information

Make sure you have the lastet version of the Install-module AzureRM.SiteRecovery (4.2.1 today)

Install-module AzureRM.SiteRecovery

 

Change the email address to someone that has rights in Azure to complete all of this work.

LoginAzureRmAccount Credential (get-credential
Credential anthony@anthonyonazure.com)

 

There are a lot of lines of code that has been commented out in the middle of the script. This was the automation portion of the on-premise installation. It could easily be adopted inside this current script to install the Config & Process server on the server that had configured Azure. I also included a link for downloading the provider if you are protecting Hyper-V.

 

The last section is also commented out. Until you register an on-premise server with ASR the Protection Container doesn’t exist and the last line that contacts Azure will fail until that exists. This is the on-premise install you need to complete, that is also commented out. So you can see where this could all be automated.

To see if Protection Container has been created use the following PowerShell command.



Get-AzureRmSiteRecoveryProtectionContainer

 

If you are looking for the script it is on my GitHub repository, AnthonyOnAzure