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.

Azure VM image

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

Azure VM image

You can select the proper subnet.

Select the management option

Azure VM image

Select the Advanced Option

Add the tags

Azure VM image

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

Azure VM image

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

Azure VM image

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

ESPC call for speakers 2024
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.

Azure VM image

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.

Azure VM image

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!!!

About the Author:

Aavisek Choudhury is working for Unisys as the Lead Azure Cloud Platform Architect and residing at Bangalore, India. He is working with multiple MS Technologies from 2000 which includes Azure, Windows Server, Exchange, Active Directory, Office Communication Server, TMG, MS Lync, Skype for Business Server, SQL Server, SCOM, SCVMM,SCDPM, MSBI and SharePoint. He is holding multiple MS certifications like Dual and Chartered MCSE, MCTIP, MCSA, MCTS etc., He has also won the Community Contributor Award from Microsoft in 2011. In 2017 he has been recognised as Azure Champs by Microsoft Association of Practising Architects (MAPA) and Awarded the Azure Master of the Month Feb. 2018 by Microsoft. His interest on Azure and O365 is growing every day from last couple of years and through this blog, he is trying to share the stuff that he knows or he’s trying to learn. He will continue to share his experience with Microsoft Azure and other Microsoft technologies. 

Reference:

Choudhury, A.(2020).How to Create an Azure VM Image and copy it to Different Regions in Azure. Available at: https://whyazure.in/how-to-create-an-azure-vm-image-and-copy-it-to-different-regions-in-azure/ [Accessed 18th May 2020].

Check out more great Azure content here

Take our Survey:
Can you take 4 minutes today and help us gain insights, with this short survey for the Microsoft 365 & Azure Community? We would love to hear from you and invite you to share your thoughts.

Share this on...

Rate this Post:

Share:

Topics:

Azure

Tags: