Migrating Azure VMs to OpenShift Virtualization on ARO
This content is authored by Red Hat experts, but has not yet been tested on every supported configuration.
Migrating virtual machines (VMs) from Azure to OpenShift Virtualization on Azure Red Hat OpenShift (ARO) is a powerful step toward unifying your traditional and cloud-native workloads on a single, enterprise-grade application platform. This guide will walk you through the process, which is designed to be surprisingly straightforward despite current technical constraints. At present, Azure primarily supports exporting VM disks in the Virtual Hard Disk (VHD) format. While Red Hat’s Migration Toolkit for Virtualization (MTV) is rapidly evolving to formally support this scenario, we will detail a practical method to bridge this gap and get your VMs running on ARO quickly.
The core benefit of this migration is transforming your VM infrastructure into an integral part of a modern application platform. Azure Red Hat OpenShift offers a fully managed application platform that brings enterprise features to your workloads, including seamless integration of VMs and containers, centralized management, and a clear path for future application modernization.
Pre-requisites
You will need an 4.18+ ARO Cluster with OpenShift Virtualization installed and configured. Follow this guide to get started
CLIs and Command Line Tools Needed
Important: The virt-v2v tool currently operates exclusively on Linux. If you do not have a Linux environment available, please deploy a Linux VM in Azure for this process.
- oc (logged into the ARO cluster)
- az
- virtctl
- virt-v2v
An Azure VM you want to migrate
Environment Variables
- Create the project for the VMs if not already created.
Export an Azure Virtual Machine to VHD format
- Deallocate the VM (Required for OS Disk)
You must deallocate the VM to ensure a clean, consistent snapshot of the OS disk, and to be able to export it.
- Get the OS Disk Name
You need the name of the operating system disk attached to the VM.
- Generate a Shared Access Signature (SAS) URL
You need to generate a read-only SAS for the managed disk, which provides a temporary, secure URL to the underlying VHD file. The –duration-in-seconds specifies how long the URL will be valid (e.g., 3600 seconds = 1 hour).
- Download the VHD File
Use the generated SAS URI with a tool like AzCopy. AzCopy is generally recommended for large files as it is optimized for high-performance data transfer.
- Get the disk size and set an environment variable
Set the following environment variable to a size greater than the above output
Convert the VHD image to QCOW format
Use the virt-v2v command-line interface to convert the Azure VM’s VHD disk image into a QCOW2 file format, placing the final result in the local ./output directory.
Migrate the VM into OpenShift Virtualization
Import the QCOW2 image of the Azure Virtual Machine into OpenShift Virtualization.
Note: This process assumes you are using OpenShift Data Foundation; if you are using a different storage class, remember to modify the –storage-class option accordingly.
Create a VM in OpenShift Virtualization
Using the uploaded image, create a virtual machine in OpenShift Virtualization.
Congratulations, you have now successfully imported an Azure VM into OpenShift Virtualization.