Nested Virtualization is supported both Azure and on-premises with the following prerequisites;
Intel processor with VT-x and EPT technology
- The Hyper-V host must be Windows Server 2016/Windows 10 or greater
- VM configuration version 8.0 or greater
AMD EPYC/Ryzen processor or later
- The Hyper-V host must be Windows Server 2022/Windows 11 or greater
- VM configuration version 10.0 or greater
For both configurations, the guest can be any Windows-supported guest operating system. Keep in mind that newer Windows operating systems may support enlightenments that improve performance.
To enable Nested Virtualization for VMs in Hyper-V, do the following:
- Create a virtual machine using the prerequisites specified above.
- While the virtual machine is in the OFF state, on the physical Hyper-V Windows host, open PowerShell in elevated mode.
- In the PowerShell console, run the command below to enable nested virtualization for the virtual machine. Substitute the <VMName> place holder with the actual VM name for the VM you created earlier.
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
- Once the command executes, you can exit PowerShell console.
- Next, start the virtual machine.
- After the VM starts, install Hyper-V within the virtual machine, just like you would for a physical machine.
Disable Nested Virtualization
You can disable nested virtualization for a stopped virtual machine. To disable Nested Virtualization for VMs in Hyper-V, do the following:
- Open PowerShell in elevated mode on the physical Hyper-V Windows host.
- In the PowerShell console, run the command below:
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $false
- Exit PowerShell once the command executes.