Migrate your pre-configured Windows Instance from on-premise or AWS to Azure

August 20, 2015 | Comments(13) |

IT industry today is fast paced compared to any other industries in this century. Growth, Upgrade, Mobility, Availability are the buzz words in today’s world. This is the only industry which is more fashion driven than women’s fashion. With the growth of Cloud Computing, people are moving their existing infrastructure to Cloud. Many tech-giants like Amazon, Microsoft, Google, VMWare are offering their services in cloud computing.

Amazon Web Services and Microsoft Azure are very frequent names for cloud services. Azure argues that its platform allows businesses to fully take advantage of hybrid cloud platforms. Azure Logic Apps works with your existing assets like legacy softwares, ERP, etc and extend it to Azure cloud. Thus with Azure, extensibility is in your control.

Problem Definition:

Cloud Consultant always get below requirements:

  • Moving your on premise Windows Server to Microsoft Azure
  • Moving your Amazon EC2 Windows Instance to Microsoft Azure.
  • We have configured SharePoint Server or Exchange Server on AWS or on premise.

To setup the same environment on Azure from scratch, might be time consuming or complicated process. So in such cases we will want to migrate preconfigured server to Azure.


To solve the above problem, I’ll take you through the below steps to migrate your AWS or on premise Windows Instance to Azure.

  • Clone the EC2 system hard drive to virtual hard drive (VHD) using a utility.
  • Run the script to push that VHD to Azure Blob Storage.
  • Create a disk from blob storage.
  • Create a VM using disk.


Step 1: Creating VHD

First we will convert our system hard drive to VHD so that we can use it to create & launch VM. To convert your EC2 system hard drive to VHD, we will use Disk2VHD utility. Disk2VHD is a free utility that creates VHD from your physical volume for use in Microsoft Virtual PC or Microsoft Hyper-V virtual machines.

Into your EC2 instance, download Disk2VHD utility from the below link:


To create VHD go through the following steps:

  1. Run the Disk2VHD tool on your EC2 instance.
  2. Uncheck the “Use VHDx” and other option in that tool.
  3. Select the disc you want to clone. (Generally it will be C drive)
  4. Give VHD a name & give the path where you want to save the cloned disk.
  5. Wait till it finish.

Disk2VHD Tool

Now that VHD is created, we need to push it to Azure. First create storage account, under that storage account we can push VHD under Blob Storage. So to perform that action go through the below steps:

  1. You need to login to you Azure Portal and create one Storage Account where you will push your VHD.
  2. Go to storage and create “New”. Provide a name to your storage account and choose the appropriate region you want.
  3. Make the note of the blob storage URL that you can see on Storage Account Dashboard.


Step 2: Pushing VHD to Azure

Once the VHD is created, run the following script/cmdlets to push it to Azure Blob Storage.

You need Azure PowerShell to run these cmdlets. Click here to download Azure PowerShell.

Run the below cmdlet to add your Azure account.

After adding Azure Account, we need to select the Subscription where we have created Storage account in step 1. So run the following cmdlet to accomplish that task:

Now we are ready to access Azure Services, use the following cmdlet to push the VHD to Azure’s storage account.

Once you run the above cmdlet, it will first calculate MD5 for that VHD file. MD5 hash of your file is to guarantee that your file is transferred correctly. After the MD5 is calculated successfully, a blob of the same size as the disk is allocated in your storage account. It will then start to upload your VHD to Azure.

MD5 calculation


Note: Uploading the VHD may take time, depending on the Internet connection and the size of the VHD.

Uploading VHD


Once the VHD is successfully uploaded, you will get the “Succeeded” message in PowerShell. You can then browse the VHD from Azure Storage. Before we can use the VHD as disk, it needs some configuration. We need to provide it some logical name that can be used in subsequent operations.

vhd in storage account


Step 3: Configuring Disk on Azure Portal

Configuration will allow us to make a disk from VHD from where we can specify that this particular VHD contains an Operating System to use it to create a VM from it. To accomplish this task, go through the following steps:

  1. Navigate to Azure Portal
  2. Go to Virtual Machines from the Menu
  3. Move to “Disks” tab.
  4. Under Disk tab, click on “Create” button.
  5. Provide a logical name for the Disk.
  6. Locate the VHD URL in Azure Blob Storage.
  7. Select (check) the VHD contains an Operating System checkbox.
  8. Ensure Windows is selected in Operating Systems family.
  9. Click the “tick” button to create Azure Disk.

creating disk from VHD

Step 4: Creating VM from Disk on Azure

Now that the disk is created, we shall create a VM using that disk. To create VM from the disk, follow the below steps:

  1. Click on the Instances tab (on the Virtual Machines section of the Azure Portal)
  2. Click on “New” button
  3. Click on “From Gallery”
  4. On the “Choose an Image” window, click on “My Disks
  5. Select the disk that you have created and click Next.
  6. On the Virtual Machine configuration page, provide the VM name, tier as Standard, select the appropriate size and click Next.
  7. On the next page, specify either a new cloud service or an existing Cloud Service.
  8. Specify the Region that contains the VHD and leave the Availability Set option “None”. Leave the default Endpoints configuration & click Next.
  9. On the third page, Unselect the “VM Agent that supports extensions” is already installed checkbox and click Launch.

My Disks VM


After completing above procedure, you can check the status of VM under Virtual Machines tab.


You can RDP into your VM and verify that your installed configurations on Amazon EC2 are the same on this VM on Azure. Even the wallpaper is not changed.

Azure VM

So in this way you can move your Windows Instance from AWS  or on premise to Azure and you don’t need to configure it whole again.

I hope the blog enriched you with some good handy information and tactics. Stay tuned for more such blogs on various Cloud platforms.

13 Responses to “Migrate your pre-configured Windows Instance from on-premise or AWS to Azure”

  1. parth lathiya

    Excellent work done by Arman….I’ll help many people ty …

  2. Rajan Desai

    To do one thing, sometimes there are so many options but choosing one best suitable option is a choice of smart person. That smart person is our expert Arman.
    Thanks for providing this easy way.

  3. Pooja Ganatra

    Great Arman……….Keep it up. (y) Gently Explained.
    Impressive lines “This is the only industry which is more fashion driven than women’s fashion.” 🙂 🙂


Leave a Reply