I have migrated to windows server 2012 EC2 instance from Amazon AWS to Windows Azure through following steps.
We assume you have Amazon account and running EC2 instances in it.
Log in to EC2 instance with credentials-
First we need to have free space on D drive on AWS Virtual machine to export the C Drive in Virtual Hard Disk (VHD) Format
We used Disk2VHD free converter tool for VHD conversion
If you do not have an additional drive then you need to add one Hard Disk and attach to running AWS EC2 instance.
Run Disk2VHD tool
Now select C drive and System reseverd Volume and give VDH file location D:\VMTEMP\WS2012VMD2.VHD
It will take time to convert.
After conversion is completed the copy of VHD from AWS has to be copied to your local machine-
There are number of ways to download your VHD from AWS to local machine For Example FileZilla In this case FileZilla was used to download the copy of VHD to local machine.
Download/Copy VHD to Local 2012 Hyper-V Host-
Login to 2012 Hyper-V host through RDP in Local environment
Locate to the path of VHD- D:\VMTEMP\WS2012VMD4.VHD
Open Windows PowerShell ISE on Hyper-V machine
And run following command-
Convert Dynamically Expanding VHD to Fixed Size VHD
Convert-VHD -Path $vhdTempPath -DestinationPath $vhdConvertedPath -VHDType Fixed
It will take some time to convert vhd to fixed size.
Install Hyper-V Integration Services by following command-
(Command to install Hyper-V integration services on Windows server 2008 and 2008 r2 and windows 7 machine is as follows
Command to install Hyper-V integration services on Windows server 2012 and windows 8 machine is as follows -
Mount VHD path as a drive by following Command-
$diskNum = ( Mount-VHD -Path $vhdConvertedPath -Passthru).DiskNumber
Make sure VHD is online by operation status command as follows-
VHD drive letter can be known by following command-
$vhdDriveLetter = (Get-Disk $diskNum | Get-Partition | Get-Volume).DriveLetter
Make sure to make the VHD writable by following command-
Set-Disk $diskNum -IsReadOnly $False Add-WindowsPackage -PackagePath $cabPath -Path ($vhdDriveLetter+":\") Dismount-VHD -Path $vhdConvertedPath
To upload the VHD to Azure following are the steps-
In this case a tool called CloudXplorer was used to upload VHD to Azure Storage (Note that this can also be done through PowerShell)
Install CloudeXplorer on the local Hyper-V machine and start CloudeXplorer-
While connecting to Windows Azure Account through CloudeXplorer it will ask for Azure Account name and Secret Key (This can be found in Azure Account web portal)-
The account will be added if the information provided is accurate.
Then the following window pops up-
Select the account then select “vhds” on the left pane and then select “Upload page blob” as shown below.
Select VHD file and click open as shown below.
Then copy operation will start as follows and it will take time to copy vhd to Azure storage.
Once VHD copied on Azure Storage it will display as seen below.
Login to Azure Account- Go to Storage TAB the uploaded vhd can be seen here –
Click on the storage name and then click Containers TAB
Select VHDS TAB and the copied VHD is displyed here.
Map the VHD to an Azure Virtual Machine Disk
The Next Step is to convert the VHD to Disk by following the process:
Go to Virtual Machine Tab on Azure Portal, Click Disks and click on Create TAB-
Map the VHD to an Azure Virtual Machine Disk
- Once the upload completes login to your Azure portal. https://manage.windowsazure.com
- Click on the Virtual Machines page and then select Disks and then Create on the bottom of the screen
- Provide a Name and then click browse to find the VHD URL that you uploaded in the previous steps
- You should also check the box indicating that The VHD contains an operating system. Then select the appropriate OS from the Operating System Family property. Click OK
The Disk is created.
Creating the Azure VM,
After completing this you can now create an Azure Virtual Machine from you .vhd you upload from your local machine.
- Click on the Virtual Machine page again and click New in the bottom of the screen
- Select From Gallery
- Click on My Disks and you will find the .vhd uploaded and assigned as a Virtual Machine disk
- Select your machine then click the arrow in the bottom right to continue
- Provide a name in the Virtual Machine Name property and select the resource plan you would like this virtual machine to use
- Click the arrow in the bottom right to continue
- Configure the DNS name for the virtual machine and which virtual group you would like to join it to then click the arrow in the bottom right to continue
- Optionally you could add third-party additional extensions to the VM. Click the check to confirm your configuration of the new VM
- Your VM will be provisioned and should be available immediately once these steps are complete. Keep in mind a lot of these steps that I did through the management portal could certainly be done using PowerShell as well.
Select the New Virtual Machine Click on Connect and login to the new machine.