Migrating a Rocky Linux KVM VM to Microsoft Azure
Introduction
This article provides step-by-step instructions for migrating a local Rocky Linux 8.10 KVM virtual machine to Microsoft Azure using Azure Migrate and the Azure Site Recovery replication appliance.
The migration process involves preparing your source VM, setting up the necessary Azure infrastructure, configuring the replication appliance, and performing the actual migration.
Problem
Organizations need to migrate on-premises virtual machines often running on KVM to Microsoft Azure for cloud adoption, disaster recovery, or infrastructure modernization purposes. The amount of VMs to migrate to the cloud can range in the thousands and services such as Azure Migrate help to make the transition smoother.
The migration process requires specific configuration steps for both the source VM and Azure environment to ensure successful replication and migration.
Symptoms
You have a fleet of Rocky Linux VMs running on KVM that needs to be migrated to Azure.
The VM requires migrating to the cloud whilst maintaining its configuration and data integrity.
Resolution
Prerequisites
Rocky Linux
-
A
Rocky Linux 8.10KVMVM(as an example, but Rocky Linux 9 and Rocky Linux 10 are also fine) with a minimum of: -
4096 MB of
RAM -
2
vCPUs -
16GB of disk space
-
SCSIdisk type
Windows Server
-
A
Windows Server 2022VMonKVM, also with a minimum of: -
16GB of
RAM -
8
vCPUs -
700GB of disk space (the replication appliance requires at least 600GB of disk space cache available)
Please check Azure Appliance requirements
Azure
-
An active
Azuresubscription with appropriate permissions -
Access to the
Azure Portal
Step 1: prepare the source Rocky Linux VM
-
Deploy a local
Rocky Linux 8.10KVMand upgrade all packages. -
Provide the
VMwith 4096 MB ofRAM, 2vCPUsand 16GB of disk as listed in the Prerequisites. -
Change the bus type to
SCSIbefore installing theOS. This is performed underHardware-->VirtIO Disk 1-->Disk busand changing the bus type toSCSI -
In the
KVMVM, enable the following firewall ports for communication with the replication appliance:
sudo firewall-cmd --add-port=135/tcp --permanent
sudo firewall-cmd --add-port=443/tcp --permanent
sudo firewall-cmd --add-port=1024-65535/tcp --permanent
sudo firewall-cmd --add-port=443/udp --permanent
sudo firewall-cmd --reload
-
Shut down the
VM -
Remove the
SATA CDROM 1hardware. -
Change the
SCSI Disk 1XMLto the following:
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/PATH/TO/<YOUR_QCOW2_IMAGE>.qcow2"/>
<target dev="sda" bus="scsi"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
- Power up the
VMand verify it boots successfully.
Step 2: prepare the Windows Server 2022 VM for the replication appliance
-
Deploy a
Windows Server 2022VMonKVMwith 16GB ofRAM, 8vCPUsand 700GB of disk space. Choose theStandard Desktopinstallation. -
Set a password and then login to the Windows Server.
Step 3: configure the Azure virtual network
-
Go to
Virtual Networksin theAzure Portaland clickCreate -
Under
Basics, select yourResource Group, enter aVirtual network nameand choose your region. -
For
Security, leave all options at default and clickNext -
For
IP addresses, leave all options at default and clickNext -
In
Tags, apply your tags and clickNext -
Click
Create
Step 4: set up the Azure Migrate project
-
Go to
Azure Migrate-->Servers, databases and web appsand selectCreate project -
Add your
Resource Group,Project Name,Geographyand clickCreate -
Under
Assessment tools, go toMigration and modernization(**note, do not use the "Azure Migrate: Discovery and assessment" option **) and clickDiscover -
For
Where do you want to migrate to?, chooseAzure VM -
For
Are your machines virtualized?, selectPhysical or other (AWS, GCP, Xen, etc.) -
Select your
Target region -
Check the box that says
Confirm that the target region for migration is "<REGION>" -
Click
Create resources -
Return to
Discoverand specify the same options forWhere do you want to migrate to?,Are your machines virtualized?andTarget region -
For
Experience type, selectSimplified Experience (Recommended) -
Go to Step 2 and click
Generate keyto create yourASR replication appliance key -
Store this key in a safe location for later use in the process.
Step 5: Install and Configure the Replication Appliance
-
Download the installer from the provided link to your
Windows Server 2022VM -
Extract the zip file's contents.
-
Open a
PowerShellwindow as an Administrator, navigate to the folder and run.\DRInstaller.ps1 -
If you receive an error about the script not being digitally signed, run this command instead and modify the path for your folder's location:
powershell -ExecutionPolicy Bypass -File "C:\Users\Administrator\Downloads\DRAppliance\DRAppliance\DRInstaller.ps1"
-
Go to the desktop and open the shortcut to the
Microsoft Azure Appliance Configuration Manager -
Click
Continuethrough theSet up prerequisites,Appliance componentsandSelect Replication appliance connectivitysteps. -
Under
Register with Recovery Services vault, provide a friendly name and theASR replication appliance keyyou generated earlier. -
Click
Loginand thenCopy code and Login -
Log in with your
Azurecredentials. -
Once the appliance is registered, click
Continue -
Under
Configure vCenter details, checkI do not have vCenter Server/vSphere ESXi server. I'll protect my servers by manually discovering them using IP addresses.and pressContinue -
For
Provide physical server credentials, clickAdd credentials -
Select the
Operating SystemasLinux, provide a friendly name and input therootuser's credentials. -
Click
Add -
Under
Provide physical server information, clickAdd server -
Input the
IPaddress of yourRocky Linux 8.10VMand clickAdd -
Click
Continueand wait approximately 30 minutes for the process to complete. -
Verify you see a green checkmark with
Completed appliance configuration successfully.
Step 6: configure replication
-
In the
Azure Portal, go toAzure Migrate: Server Migrationand clickReplicate -
Leave other options as default and for
Are your machines virtualized?choosePhysical or other (AWS, GCP, Xen, etc.) -
From
On-premises appliance, choose your appliance and selectContinue -
For
Basics-->Guest credentials, choose yourRocky Linux 8.10VM'sguest credentials. -
Select the checkbox next to your
VMwhen it appears and clickNext -
For
Target settings, choose yourVirtual networkcreated earlier, leave other options as default and clickNext -
At
Compute, clickNext -
For
Disks-->Disk Type, selectStandard SSD(or another disk type of your choice) and clickNext -
For
Tags, add your tags and clickNext -
At
Review + Start replication, chooseReplicate
Step 7: perform the migration
-
Skip the
Test migrationstep if not needed and go toMigrate -
Leave the default
Azure VMoption and clickContinue -
Select the
VMyou want to migrate and leaveYes, shutdown virtual machines(Ensures no data loss)checked. -
Click
Migrate
Step 8: configure network access for the migrated VM
-
Once complete, your local
VMwill shut down. -
Go to
Virtual MachinesinAzure Portalto access your newly migratedVM -
Navigate to your newly created
VMunderVirtual Machines, thenNetworkingand thenNetwork settings -
Click
Add network security group -
When the
network security groupis created, clickCreate port ruleand selectInbound port rule -
Specify an
IPaddress, source and destination ports, the protocol to use, and theActionto allow or deny traffic. -
Click
Save -
For temporary
SSHaccess testing, you can setSourcetoAny,Source port rangesto*,Destination port rangesto22. Please check with your Security Team on how ports, protocols and IPs should be set up first for best security practices. -
Click
Add
Step 9: configure a public IP address
-
Under
Networking-->Network settings, check that aPublic IP addressis listed. -
If not present, click
(Configure)and click on yourNIClisted in the table. An exampleNICname isnic-rocky-linux-810-00-ipconfig -
Check the box next to
Associate public IP addressand clickSave -
Refresh the
IP configurationspage to see thePublic IP Address -
Go to your
VM, thenConnectand selectNative SSH -
sshinto your machine with therootaccount or another configured account.
Notes
The migration process may take considerable time depending on the size of your source VM and network bandwidth.
Always perform a test migration before executing the final migration in production environments.