Tutorials

Migrate a Windows Virtual Machine from Azure to ProfitBricks

Table of Contents

Introduction

This tutorial is designed to assist in moving a virtual machine running the Microsoft Windows operating system from the Azure cloud to the ProfitBricks cloud.

Downloading the VHD from Azure

Log into your Azure account.

Click on the Storage section.

Click on the name of the storage which correlates to the location of your Virtual Machine:

Azure Storage

Click on the Containers section, then on vhds:

Containers VHDs

Next you will need to find the machine you’d like to download, for which you’ll have two files: the status and VHD file.

List of VHDs

Validate you have selected the correct VHD file by looking at the file extension and size of the file.

You have the option to click Download at the bottom of the page to begin the download of the VHD to your local machine. From experience we have found that the download can take longer using this browser/http method. It is faster to use the PowerShell Save-AzureVhd cmdlet as outlined below.

If you prefer to follow our recommendation and utilize PowerShell, then click in the URL and you will get a "Copy" button to copy the URL to the clipboard.

VHD download URL

Once you have the URL of the VHD, you can paste that into the PowerShell script below.

You will need to have your Azure credentials or have your Publisher Settings file from Azure to make the connection successfully.

For additional information, please see How to: Download and Import Publish Settings and Subscription Information.

Edit the PowerShell script below and replace the example values with:

  • Line 1: The location of your “Publisher Settings File.”
  • Line 2: The URL for the VHD you copied to the clipboard a moment ago.
  • Line 3: The local destination where the downloaded VHD should saved. Validate that the specified path exists and that there is enough space available to hold the downloaded VHD image.
  • Line 4: Optionally alter the "NumberOfThreads" setting. Please read more information on threads if you wish to adjust this value.

Here is the example PowerShell script:

Import-AzurePublishSettingsFile "C:\AzureInstance_credentials.publishsettings"
$sourceVHD = "https://[storage ID].blob.core.windows.net/vhds/VirtualMachineName.vhd"
$destinationVHD = "D:\VM\VirtualMachineName.vhd"
Save-AzureVhd -Source $sourceVHD -LocalFilePath $destinationVHD -NumberOfThreads 10

Save your changes and run the PowerShell script.

You should see a progress bar appear when the download has started. It will disappear once the VHD download has completed.

Please Note: The full VHD space is allocated before the downloading actually begins. ~130 GB downloading at ~10 MB/s will take about 8-12 hours.

Upload the VHD to ProfitBricks

Find the connection details of your ProfitBricks Data Center FTP. FTP details for each data center can be found by logging into the DCD and clicking on Help > FTP Image Upload.

Connect to the FTP server using a FTP client or other method, and navigate to either the HDD or ISO folder once you have logged in.

Upload your VHD file.

Once the upload has completed, you will receive a confirmation e-mail indicating when your image is going to be processed and an estimated time until the image is available.

Note: The larger the image, the longer the import process will take. For example, a hard drive image of 130 GB VHD will generally take 1-2 hours.

Once the image has been processed, you will see the VHD image name appear in the Image Manager within the DCD for the data center location you uploaded it to.

Post-process VM Preparation

Create a new server and HDD Storage objects in the DCD. It is recommended that the resources assigned for cores and memory are consistent with what was previously used in the Azure cloud. These can be adjusted to fit your workload after properly preparing the machine for use in the ProfitBricks cloud.

The HDD size will adjust automatically once the uploaded image is associated with a storage volume.

Create and attach a second HDD Storage object to the server of 1 GB. We will briefly use this later and then remove it.

Click on the first HDD Storage and under the DCD Inspector, drop down the Image and select the Azure VHD image you had uploaded.

DCD Own Images List

Click on the server you created, and under the Inspector, go to Storage and click Add CD-ROM.

Under Image, go to ProfitBricks Images and select the windows-VirtIO-driver-1.xxx.iso.

Once selected, click Create CD-ROM.

DCD Create CD-ROM

Note: Some older operating systems may require other versions of the Red Hat VirtIO drivers. Please see the ProfitBricks FAQ on VirtIO Drivers for additional information.

Click on the server object, then from the DCD Inspector, go to the Storage tab and change the Bus Type to IDE.

DCD Storage Change Bus Type

Note: Keep the secondary HDD Storage drive (1 GB) as Bus Type "VirtIO".

Alternative: If you prefer to boot from the VirtIO drivers .iso and use the installation script it provides, you need to tell the system to boot from the CD-ROM. Skip to Alternative VirtIO Installation and proceed with those instructions.

Provision all changes.

This provisioning may take a bit of time depending the size of your VHD file.

Once provisioned, if the machine status does not say “Running”, select Power > Start, and then provision the changes. You may be prompted for your password to start billing.

While in Internet Explorer, check that the VM is in the “Running” status, you will click on the server then connect to it using the Remote Console button.

Once the console loads, you should be presented with a Windows login screen.

Send CTRL+ALT+DEL keys and log into the machine.

Note: see Alternative Step for a different way to proceed.

Go to Computer Management > Device Manager.

You should or may see two unrecognized devices, an Ethernet Adapter and a SCSI Adapter

For each unrecognized device, right-click, update Driver, select/scan from local computer à CD-ROM. Should a warning about driver signature will come up, select “Install this driver software anyway/Continue Anyway”.

After Red Hat VirtIO Storage and Network Drivers have been installed, you should see the second HDD in disc management. You do not need to bring the disk online at this time.

Shut down the VM from the Start menu.

From the DCD, click the Server > Storage tab, remove CD-ROM (drop-down the VirtIO image, select Remove Image) and change the boot drive from IDE to VirtIO.

Delete the second HDD Storage from the server object from the DCD.

Provision your change(s).

After the provision, if the machine is not in the "running" status, start the machine again.

Go ahead and skip to the summary.

Alternative VIRTIO Installation

An alternative method for installing the drivers into an existing image is to boot directly into the CD-ROM for the VirtIO drivers. In order to do this, you must select this as the Boot Device in Step 5 above. This process will take over starting at the login to the Remote Console. You should be presented with a screen showing the below command prompt in order to install the drivers used by ProfitBricks.

VIRTIO Install

Press any key to continue and select the proper option for drivers, type the menu option and press Enter:

VIRTIO Install Choose OS

Once the drivers have been copied/installed, you can press Enter to shut down/reboot the machine.

VIRTIO Install Reboot

Back in the DCD, go to the Storage tab, remove the VirtIO image from the CD-ROM and make the HDD the Bootdevice again.

Then provision the change(s).

Once you’ve started the VM, use the Remote Console to log into the virtual machine using the same credentials you did as in Azure.

Go to Computer Management > Device Manager.

You should or may see two unrecognized devices, an Ethernet Adapter and a SCSI Adapter

For each unrecognized device, right-click, update Driver, select/scan from local computer à CD-ROM. Should a warning about driver signature will come up, select “Install this driver software anyway/Continue Anyway”.

After Red Hat VirtIO Storage and Network Drivers have been installed, you should see the second HDD in disc management. You do not need to bring the disk online at this time.

Shutdown the VM from the Start menu

From the DCD, click the Server > Storage tab, remove the CD-ROM (drop-down the VirtIO image, select Remove Image) and change the boot drive from IDE to VirtIO.

Delete the second HDD Storage from the server object in the DCD.

Provision your change(s).

After the provision, if the machine is not in the Running status, restart the virtual machine.

Summary

At this time you should have a fully working virtual machine with all the proper drivers installed. You may need to do additional post-migration tasks such as joining the machine to a proper domain and/or updating network settings.

Thank you for following through the tutorial and please feel free to add any questions or comments below or by opening a discussion in the Community section of this website.