How to move/upload Virtual Machines to Azure

Well, today a blog post about moving existing machines to Azure.

This article shows you how to move an existing server environment to Azure by uploading and configuring these machines (in my case my System Center Demo Environment).

This is my experience on uploading my demo machines onto Windows Azure.

Before we start
There are some requirements and limitations in Azure. Underneath a list of things you should always do/check

Size and amount
– Each data disk can be max 1 TB in size
– Max number of data disks depends on VM size
– Up to 16 data disks

– Only vhd-files (not vhdx-files) – Conversion is in this document
– Only fixed size vhd-files (converts during upload to Azure) 
– No differencing vhd-files

Disk speed limitations
– The maximum workload in IOPS per data disk is 500. See this link for more information. This can be a bottleneck in heavy environments

Note: If you are used to using CSUpload.exe for uploading VHDs you should switch to PowerShell. CSUpload.exe has been marked as deprecated and will likely not ship in future SDKs.

The next steps take you in detail to move the existing machines onto Azure. From configuring the virtual machine to moving.

Step 1: Enable remote desktop and convert the machine
First we need to enable remote desktop on the virtual machine. This is to enable access when it’s moved to Windows Azure.

1. Move your mouse to bottom right of the screen and you would see a bar, Charm Bar.
2. Click on the Settings button,
3. Click on Server Info under Desktop
4. The Server Info launches the Control Panel System page. Click Advanced System Settings on the right. This would launch the same System Properties page.
Remote Desktop
5. Select the appropriate option under Remote Desktop and click OK.

Step 2: Disable the Windows Firewall on the local machine
Well when moving machines into Azure there are some firewall issues when connecting via RDP (there is a possibility that the LAN will be recognized as public and therefore is not available) . Therefore the firewall should be temporary disabled.
1. Click Start, click All Programs, click Administrative Tools, and then click Windows Firewall with Advanced Security.
2. In the navigation pane, right-click Windows Firewall with Advanced Security on Local Computer, and then click Properties.
3. On each of the Domain Profile, Private Profile, and Public Profile tabs, change the Firewall state option to Off
Disable Firewall
4. Click OK to save your changes.

Step 3: Migrate the VHDX to VHD

When moving a machine to Azure the VHD format is required. If you already have a VHD file that you would like to use, you can skip to Step 3.  You’ll be copying this VHD to the cloud, when you use dynamically expanding disks this will be solved during the move to azure. No extra steps are required for dynamically expanding disks.
1. Open Powershell (runas Administrator)
2. Run convert-vhd ‘D:\Hyper-V\DC01\Virtual Hard Disks\DC01.vhdx’ ‘D:\DC01.vhd’ (fill in the proper path name)


Step 4: Create a storage account in Windows Azure
A storage account represents the highest level of the namespace for accessing the storage services and is associated with your Windows Azure subscription. You need a storage account in Windows Azure to upload a .vhd file to Windows Azure that can be used for creating a virtual machine. You can use the Windows Azure Management Portal to create a storage account.
1. Sign in to the Windows Azure Management Portal.
2. On the command bar, click Storage, Create a storage Account.
Create Storage Account
3. Click URL and give it a name, choose the location/affinity group and replication settings and click create storage account

Step 5: Prepare the connection to Windows Azure
Before you can upload a .vhd file, you need to establish a secure connection between your computer and your subscription in Windows Azure.
1. Go to and download and install the default stuff.
2. First we going to load the certificate needed; Open a Windows Azure PowerShell window.
3. Type: Get-AzurePublishSettingsFile This command opens a browser window and automatically downloads a .publishsettings file that contains information and a certificate for your Windows Azure subscription.
Import Certificate
4. Save the .publish settings file (I saved it in C:\Azure Cert)
5. Type: Import-AzurePublishSettingsFile <PathToFile> in my case Import-AzurePublishSettingsFile ‘C:\Azure Cert\Microsoft Partner Network-3-14-2014-credentials.publishsettings’
6. When the certificate is imported type Get-AzureSubscription to check if it’s working.
Check Subscription

Step 6: Upload the .vhd file
When you upload the .vhd file, you can place the .vhd file anywhere within your blob storage. In the following command examples, BlobStorageURL is the URL for the storage account that you created in Step 2, YourImagesFolder is the container within blob storage where you want to store your images. VHDName is the label that appears in the Management Portal to identify the virtual hard disk. PathToVHDFile is the full path and name of the .vhd file.
1. Get-AzureSubscription to check the subscription we need (in my case the Microsoft Partner Network subscription
2. Select-AzureSubscription “Microsoft Partner Network” to login in the subscription
3. Set-AzureSubscription –SubscriptionName “Microsoft Partner Network” –CurrentStorageAccountName “systemcenterdemo”
4. $sourcevhd=”D:\DC01.vhd”
5. $destinationvhd = “”
6. Add-AzureVHD –LocalfilePath $sourcevhd –Destination $destinationvhd to upload the virtual machine into Azure
For more information, see Get Started with Windows Azure Cmdlets


Step 7: Prepare the Virtual Network:
As I want to change the IP address assignment, I did configure a new Virtual Network, note that Azure assigns an auto created IP address to the moved server:
1. From the Windows Azure Manager portal go to Networks. Then select Virtual Network, Create a Virtual Network.
2. Assing a name to the Virtual Network, select the region where you want keep your Virtual Network and Create a new affinity Group (any Virtual Network need be assigned to a affinity group).
For this example the Virtual Network won’t be connected to our on premise network.
3. Add the address range
4. Don’t choose a DNS server (the DC VM had the DNS service enabled for internal name resolution).
5. Accept and create the new Virtual Network.


Step 8; Create the Virtual Machines
OK hang on there where almost finished moving our machine into Azure.
1. In the Windows Azure Portal select Virtual Machines, Disks, Create Disk.
2. In Create disk from VHD window, set the disk name, of the VHD (in my case an Operations Manager Server), select the VHD, mark the option “This VHD contains an operating system” and the Operating System Family “Windows”. Accept and create the disk.

OK were almost there, now we are going to create the Virtual Machine.
3. Click on Create, Virtual Machine, From Gallery
4.Select “My disks” and then select the disk created for the image 

5. Specify the VM name and size. image
6. Introduce a DNS name for the VM, select the Affinity Group and select the Virtual Network created before.
7. Next we can set the RDP and Powershell options. We leave them all default, click Next

8. Wait a few minutes for the VM provisioning.
9. Once the machine is up and running, you can connect to the VMs and check if all it’s OK; it can be that a hard reboot is required before you can login.
Running Machine


Step 9: Enable the Windows Firewall on the local machine
-Click Start, click All Programs, click Administrative Tools, and then click Windows Firewall with Advanced Security.
-In the navigation pane, right-click Windows Firewall with Advanced Security on Local Computer, and then click Properties.
-On each of the Domain Profile, Private Profile, and Public Profile tabs, change the Firewall state option to On
OK, that’s it, we are now running our servers in Windows Azure. This without doing anything else than uploading my VHDs and configure the Virtual Network, Storage and VMs.