Azure recently start to support the Generation 2 VMs. Before When we create a VMs inside Azure it uses the Generation 1 VMs. If your work with Hyper-V in on-premises environment generation of the VMs are not an strange thing. Because Hyper-V support Generation 2 VMs from Windows Server 2012 R2. Inside Azure datacenter it also uses Hyper-V as a virtualization platform but compared the the on-premises OS its a customized OS, specially design for Azure datacenter.
Currently generation 2 VMs are in a preview state, we need to consider before using generation 2 because its impossible to change after creating VM.
In generation 2 VMs have features that are not available in generation 1 as increased memory, Intel Software Guard Extensions (Intel SGX), and virtualized persistent memory (vPMEM).
Generation 2 VMs use the new UEFI-based boot architecture rather than the BIOS-based architecture used by generation 1 VMs. Compared to generation 1 VMs, generation 2 VMs might have improved boot and installation times.
Currently not all VMs in Azure supported for generation 2 VMs. Following is the list currently supported.
- Dsv2-series and Dsv3-series
- Esv3-series
- Fsv2-series
- GS-series
- Ls-series and Lsv2-series
- Mv2-series
Generation 2 VMs support the following Marketplace images:
- Windows Server 2019 Datacenter
- Windows Server 2016 Datacenter
- Windows Server 2012 R2 Datacenter
- Windows Server 2012 Datacenter
Difference between on-premises generation 2 VM svs Azure generation 2 VMs
Generation 2 feature | On-premises Hyper-V | Azure |
Secure boot | Yes | No |
Shielded VM | Yes | No |
vTPM | Yes | No |
Virtualization-based security (VBS) | Yes | No |
VHDX format | Yes | No |
We can create a generation 2 VM from Azure portal and Azure CLI as below
Azure Portal
First we need to select VM which support generation 2 VM. we can search in Azure marketplace as below to find a VM.
Search for the VMs

Select the VM with Gen2 enable

Select it and create the VM.

Azure CLI
Following command can be used for create VM through CLI
az vm create \ --resource-group Gen2VMs \ --name myVM \ --image MicrosoftWindowsServer:windowsserver-gen2preview:2019-datacenter-gen2:latest \ --admin-username localadmin \ --admin-password [email protected]
Following is the screenshot verifying running on generation 2

Additional Links