How to create an Azure VM Image and copy it to different regions in Azure

Hello, readers hope you are all safe in this Covid-19 pandemic situation. For the last couple of months, I have got many requests to write about work from home solutions, and most of them are related to Citrix VDI deployment steps in Azure, so I have decided to start a 15 series blog to show how you can deploy Citrix VDI in Azure IaaS.

But this blog is different it’s actually talking about how you can create a Windows 10 Multi-Session VM Image and how you can move it to different Azure Regions, which is not possible at present from the Azure Portal. This technique will help you if you already using the Citrix Cloud and deploying images to various Azure Regions, or will be helpful in other situations when you need to move the images across regions.

So let’s start with the creation of an image. Let’s follow the below steps.

First Create a new Virtual Machine in Azure, as you can see below.

I have selected the standard disk for the lab purpose, the actual sizing you can do by following the Citrix VDI sizing calculator.

You can select the proper subnet.

Select the management option

Select the Advanced Option

Add the tags

In the last step submit the deployment and click on the create button.

Once the VM is ready, do the following

RDP to VM

Open the Sysprep tool at the below path

%windir%\system32\sysprep

Run Sysprep and select below option

Now you can shut down from the VM and de-allocate(Stop) it.

Once done please do the following. Create a new resource group as shown with the below PowerShell Command.

Now click on the capture button in the VM tab in Azure as shown below.

In the next step, you can create the image and select the resource group which has been just created for this.

Now you can see the image is creating

And once the image is created you will get the below confirmation.

Up to this, it was easy but now the difficult part you need to move this image to a different region in Azure and currently, there is no tool available in the portal with the help of which you can do that. So we will do it in the following way as you can see below.

The prerequisite for this task is as follows.

  1. Azure CLI must be installed in your laptop or VM from where you will run the below command.
  2. Python should be installed on your laptop or VM from where you will run this below command.
  3. Azure CLI extension must be installed, with the below command. (The GitHub source of this Az CLI extension can be found here.)

az extension add –name image-copy-extension

Once installed you can again log in to the Azure CLI from the command prompt.

Step 1:  Login to Azure CLI

 

az login

 

Step 2:  Select subscription

 

az  account set –subscription “Your_Subscription_Name”

 

Step 3:  Copy image.

 

az image copy –source-resource-group SOURCE-RG –source-object-name AZEUS2WIN10VMS-image –target-location australiaeast –target-resource-group DESTINATION-RG

 

Note: Python 3.0 and Azure CLI should be installed in the system from where it has to be run.

Once you run the command you can see below screen.

And after some time you can see the following once the image has been copied to another region.

You can also go to the portal and view the already copied image in the other region. Please note this may take 2 hr. to 24 hrs. or more to copy depending on the size of your image and available bandwidth. You can also simultaneously copy multiple images from the same laptop or VM by opening a separate command prompt window. That’s all for today, I hope you are enjoying your WFH, please wait for my next 15 blog series on the deployment of Citrix VDI on Azure which I am planning to publish in weekly installment.

You have a good day ahead and enjoy the reading!!!

 

Add a Comment

Your email address will not be published. Required fields are marked *