How to migrate an Azure Windows Instance to OCI using Azure export

Leandro Michelino
5 min readJan 9, 2021

You have some Windows VM’s running on Microsoft Azure and you want to move it to Oracle Cloud. So, in this lab, I’m going to show you how to move a Windows Server 2012 R2 Server to OCI with a few steps. Be aware that using this method, you must shutdown your VM for a while during the disk export process and the Disks cannot be bigger than 400GB to be imported on OCI. Also, you can use this VirtIO Drivers to migrate from other Cloud Vendors such as AWS/GCP.

So, let’s start it!

On Azure ->

First step on the Windows VM, we must install a driver which will allow the Windows to recognise The Oracle VirtIO Drivers for Microsoft Windows are paravirtualized (PV) drivers for Microsoft Windows guests that are running on Oracle Linux KVM. The Oracle VirtIO Drivers for Microsoft Windows improve performance for network and block (disk) devices on Microsoft Windows guests and resolve common issues.

Can be downloaded here: https://blogs.oracle.com/linux/announcing-oracle-virtio-drivers-115-for-microsoft-windows

1- Download & Upload the Zip file into your Windows VM.
2- Install and Reboot the VM.

Now go you Windows VM and do the following:

3- Stop you Window VM on Azure

4- Go to the VM Disks session:

You can Export more than one Disk at time if you have many disks attached.

5- Select the Disk(s) that you want to migrate and then go to Disk Export session:

There you are going to create an export URL for you disk, select the amount of time you think it is gonna take for the export process.

6- Now we can download the VHD disk to you laptop or other place that you wish, next step we gonna convert it to qcow2 format for OCI.

The File can be downloaded via wget, browser or third party software as you wish.

8- Once it’s downloaded, we need to convert it from VHD to qcow2 (OCI format) using the qemu tool.

It can be downloaded here: https://www.qemu.org/download/#linux

9- Now, let’s convert the disk from VHD to QCOW2. So, now run:

qemu-img convert -f vpc -O qcow2 azuretooci.vhd azuretooci.qcow2
My vhd file is azuretooci.vhd, change the command line to your respective file name

Now we have our disk converted to qcow2 from vhd, so, the next step is upload it to OCI Object Storage Bucket.

How do we do that?

First of all, install the rclone tool, https://rclone.org/downloads/

In my lab, I’m using:

curl https://rclone.org/install.sh | sudo bash

So, once installed, go to the rclone configuration file and edit as below with your credentials (you can check in the OCI session below how to get your OCI credentials):

vi .config/rclone/rclone.conf [azuretooci]
type = s3
provider = Other
env_auth = True
access_key_id = 6246dd108e976d901e*****************
secret_access_key = 3LhprvX0MDzAvQB/**************
region = uk-london-1
endpoint = https://ocipaasmigration.compat.objectstorage.uk-london-1.oraclecloud.com
location_constraint = uk-london-1
acl = bucket-owner-full-control

OCI ->

Now you need to create a Customer Secret Key for that: https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/managingcredentials.htm#To4

So, when you create your Access Key, OCI generates an OTP (One Time Password) for it, so, make sure you don’t lose it, there’s not way to recover it.

Paste this password to the secret_access_key field onto rclone.conf file.

Copy and save it, in case you loose this password, you gonna recreate the Access Key entirely again

So, now copy you Access Key and paste onto rclone.conf file.

Copy the Access Key and paste it to your rclone.conf file.

So… we do we do now? Let’s import it to a Compute VM finally!

Confirm if your qcow2 file has being correctly uploaded:

Now you have to go to Compute console and Custom Images:

Then, select the Name for your Custom Image, also, provide the OS Type and Version:

Select the option to Import from an Object Storage bucket:

1- Select the Bucket in the correct compartment
2- Select the object name (file name)
3- Image Type, in this case: QCOW2
4- Mark Paravirtualized Mode, if not marked as default.
5- Finally, Import Image.

Await for the Import process finish:

It normally, takes a few minutes to complete.

Once it is finished, it’s time for to create our Windows Instance on OCI !

Click on Create Instance

In this section, we need to complete the normal steps:

  • Name of the VM
  • Compartment
  • Availability Domain
  • Leave the Image as is.

Continuing the VM setup:

5- Select the VCN (Virtual Cloud Network)
6- Select the Subnet Public (or Private) depending your configuration

In this lab, I’m using a Public subnet, so, I’m connecting via Public IP.

Once you finish the VM setup configuration, click in Create Instance:

Once the Instance Creation is done, you are ready to connect to your New Instance via RDP

Well done! Your Azure VM it’s now running on OCI !

I didn’t cover in this tutorial how to install other OCI Management drivers, which can be found here:

More Information:

--

--