Convert Azure VM's from Gen1 to Gen2

Convert Azure VM's from Gen1 to Gen2

Aug 9, 2024 10:26:50 AM

When you want to use Windows 11 in your VDI, no matter if Citrix or Azure Virtual Desktop, you need to run on Generation 2 VM ' and the upgrade process is not straight forward. 

Are you planning to upgrade your Virtual Desktop Infrastructure (VDI) to Windows 11? If so, you need to act now: Windows 11 requires Generation 2 VMs. Without this upgrade, your current Azure VMs won't meet the necessary requirements for Windows 11 operating system. This blog will explore the challenges and solutions for migrating Azure Virtual Machines (VMs) from Generation 1 to Generation 2. To simplify your life, we have developed a script that facilitates this process, which you can request below.

Reasons for Upgrading

Upgrading your Azure Virtual Machine to Generation 2 offers several significant benefits:

  • Increased Memory and Disk Limits: Generation 2 VMs support larger memory and OS disk sizes, accommodating more resource-intensive applications.
  • Enhanced Security: Features like Intel Software Guard Extensions (SGX), along with future support for Secure Boot and Virtual Trusted Platform Module (vTPM), enhance security.
  • Improved Performance: The UEFI-based boot architecture can lead to faster boot and installation times compared to the BIOS-based architecture of Generation 1 VM's.
  • Virtualized Persistent Memory (vPMEM): This feature provides better performance for applications requiring high-speed storage.
  • Performing in-place upgrade: When the current OS is already End-Of-Life (EOL) or soon to be EOL, and you don’t want to reinstall it from scratch, an in-place upgrade is an option only if the VM is Gen2 (except for servers).

For a detailed overview of Generation 2 VM's capabilities, visit Microsoft Official Gen1 to Gen2 Documentation

Upgrading Virtual Desktops: Windows 10 to Windows 11 require Gen2 VM's

One common scenarios that drive this upgrade is transitioning from Windows 10 to Windows 11 in a Virtual Desktop Environment. We have developed an in-place upgrade method to avoid redeploying the VM 's from scratch.

Challenges Faced

During the initial pre-installation checks of Windows 11, you encounter issues where the setup process indicates that the device doesn't meet Windows 11's minimum requirements, such as TPM and Secure Boot. Generation 1 VM's use a legacy BIOS with an MBR-initialized OS disk, while Windows 11 requires UEFI with a GPT-initialized OS disk, supported by Generation 2.

Azure Host upgrade from Generation 1 to Generation 2

Can I migrate from Gen1 to Gen2, not really?

If you refer to Microsoft's documentation, you will find no direct conversion options and a recommendation to create a new machine. In their FAQ section, there is this answer, basically saying you need to create a new machine.

Migrate from Generation 1 to Generation 2 Microsoft answer NO

Getting Unstuck!

The upgrade process necessitates creating a new VM. Drawing from Hyper-V Gen1 to Gen2 conversion methodologies, we have developed a repeatable process through experimentation, trial and error and collaboration among the experts at NUDGEIT.

Steps to Convert Generation 1 to Generation 2

Upgrading your Azure VM from Generation 1 to Generation 2 involves a series of precise steps to ensure a smooth transition. Follow these steps to complete the conversion and prepare your VM for Windows 11:

  1. Snapshot the VM: Take a backup snapshot before starting.
  2. Convert OS Disk: Use the built-in mbr2gpt tool to convert the OS disk to GPT within the VM.
  3. Shutdown the VM: Power down the VM.
  4. Snapshot the VM Again: Take another snapshot, specifying the snapshot type as Gen2.
  5. Create a New OS Disk: Generate a new OS disk from the Gen2 snapshot.
  6. Delete the VM: Remove the VM, retaining the NIC and disks.
    • Note the position (LUN) of additional data disks for reattachment.
  7. Create a New Gen2 VM: Deploy a new Gen2 VM using an equivalent Microsoft image, with standard Security only.
    • Reuse the NIC and data disks from the original VM.
  8. Swap OS Disks: Shutdown the new VM and replace the OS disk with the one from the snapshot.
    • Reattach any additional data disks, maintaining their original LUN positions.
  9. Start the VM: Allow the OS to adjust to the new environment.
  10. Verify: Ensure the VM runs correctly as a Generation 2 VM.
  11. Enable Security Features: After verifying functionality, enable Gen2 security features in the “Trusted Launch” security type

To make this process even easier, we have created a comprehensive 650-line script that handles the conversion for most cases. The absolute easiest way to upgrade the Machines from Generation 1 to Generation 2 is simply to reach out to NUDGEIT and get a quote, which is right here: Get a VM upgrade quote.

To get the Script please click on the get script button below. This is a PowerShell script hence you browser may block it, allow .ps1 downloads.

Generation 1 to Generation 2 conversion script

Script Requirements and Execution

Ensure the following prerequisites and constraints are met before running the script:

  • Ensure the following prerequisites and constraints are met before running the script:
  • Save the script as Convert-AzVMv1TOv2.ps1.
  • The MBR2GPT.EXE tool exists only in Windows (client or server) starting from build 1703.
  • The script will fail in any lesser build..
  • The VM must be in a 'running' state.
  • You must have Contributor rights on the VM's resource group.
  • For 'TrustedLaunch' enablement, ensure the VM is not under the standard backup policy, as enhanced security features require an "Enhanced" backup policy.
  • If your VM components, like disk, NIC and Public IP, have the setting ‘Delete with VM’ enabled, please uncheck this option prior to running the script.
  • The script will create the Gen2 VM without Zone Redundancy. If it was enabled on the original VM, please turn it on manually.
  • Some unforeseen VM configurations may not work as expected.
  • The script execution creates resources, some of them will remain after the execution.

Running the upgrade Script

For precise instructions and a comprehensive example on running the script, always refer to the Instructions Running Generation 1 to Generation 2 Upgrade Scrip  page. It is highly recommended that you review this page thoroughly before executing the script.

If you want NUDGEIT to do the upgrade you can simply contact us, Get a VM upgrade quote.

Alternative fill in this form to get the Script, we will send it together with the instructions.

 

 

Submit a comment

You may also like

Recommended reading for the modern workplace: Reinventing Jobs
Recommended reading for the modern workplace: Reinventing Jobs
9 May, 2022

I’ve been an avid reader of the latest thinking on artificial intelligence and its application in the workplace, but wit...

Re-engineering your processes? Don't delay - automate today!
Re-engineering your processes? Don't delay - automate today!
11 February, 2022

In increasingly competitive marketplaces, organisations are often scrambling to improve business processes in the hope o...

Family of Microsoft Products – 1+1+1 = much more than 3
Family of Microsoft Products – 1+1+1 = much more than 3
7 June, 2022

A Family of Microsoft Products – Why are they so important for your business? You are likely to be familiar with how qui...