Skip to content
CAMPUX
Field notes · Azure · How-to
Azure · Compute · Hyper-V

Azure VM nested virtualization — what it is and how to enable it

By 8 min read

A VM inside a VM sounds like a party trick until you need a Hyper-V lab, a WSL2 build agent, or a throwaway nested Kubernetes cluster on hardware you don't own. Then it's the cleanest tool you have — if you picked the right size.

Nested virtualization runs a hypervisor and its VMs inside an Azure VM. It requires a documented supporting VM size, compatible guest OS and security configuration. Dsv5 is one supported series; do not infer support merely because a D/E series is newer. Check the exact size and guest prerequisites before deploying.

That last sentence is the whole reason this article exists. Every other part of nested virtualization is well-trodden — turn on the Hyper-V role, build a switch, create a VM, done. The part that eats an afternoon is that Azure will happily let you deploy the Hyper-V role onto a size that can't run it, give you no error at install time, and then throw a cryptic hypervisor failure the moment you start a guest. The discriminator between "it works" and "it silently doesn't" is the VM size. Get that right first and the rest is a ten-minute job.

What it actually is

Normal virtualization has two layers: physical host, and the VM running on it. Your Azure VM is that VM — it runs on Microsoft's hypervisor, on Microsoft's hardware, in Microsoft's datacenter. Nested virtualization adds a third layer. Inside your Azure VM you run another hypervisor, and that one hosts VMs of its own. Three layers deep: physical host → your Azure VM → the inner VMs you create.

For that to work, the CPU virtualization extensions — Intel VT-x or AMD-V — have to be visible to the guest operating system, not just to the physical host. Most cloud VM sizes hide them, because the guest has no reason to see them. The sizes that support nesting are the ones Microsoft deliberately configured to pass those extensions through. That is the entire mechanism, and it is why size is destiny here.

The Hyper-V role installs on any size. The inner VM only boots on the right one.

When you'd reach for it

This is not a feature you use every day. It earns its place in a handful of specific situations, and knowing them keeps you from over-engineering a problem that a plain virtual machine or a container would solve more cheaply.

The size requirement — the part that trips everyone

Check the exact VM series, guest OS and security configuration rather than treating every newer D/E size as compatible. Microsoft lists nested virtualization in each series’ feature table; Dsv5 is one documented example. Arm-based, constrained and specialized families can differ. Confirm prerequisites before deploying the lab.

The trap is that Azure gives you no guardrail. There is no validation step that says "this size can't nest." You deploy, you enable Hyper-V, the role installs cleanly, you build a switch — and only when you press start on an inner VM does it fail, usually with a message about the hypervisor not being available. If you don't know to suspect the size, you'll burn an afternoon checking your switch config, your inner VM's boot order, your ISO. The config is fine. The silicon under you just isn't exposing what Hyper-V needs.

The one check that saves the afternoon

Before deploying, check the size’s documented feature support and the guest prerequisites. If Hyper-V fails, verify the chosen size, security configuration and available memory as well as the guest features. A firmware check alone is not a complete compatibility test. A supported size change may be possible; do not assume rebuilding is always required.

When to use Azure nested virtualization — and when not
SituationReach for nesting?Why
Hyper-V lab / training environmentYesYou need a real hypervisor and the freedom to build and destroy hosts on demand.
Windows Sandbox or WSL2 on a cloud VMYesBoth depend on the Windows hypervisor platform, which needs nesting on the host.
Isolated per-developer VMs on one hostSometimesWorks, but check whether separate small Azure VMs are simpler and cheaper first.
Running containersNoUse a container runtime or managed Kubernetes — no need for a nested hypervisor.
Production workloadsNoThe nesting overhead and single-host blast radius make this a lab tool, not a platform.
Nested-in-nested (3+ hypervisor layers)NoAzure exposes one level of nesting. Inner VMs can't run a working hypervisor.
Older A-series / D / Dv2 sizesNoThey don't expose the virtualization extensions to the guest — it will fail silently.

How to enable Hyper-V inside the guest

Assume you've deployed a Windows Server VM on a supporting size — use a documented supporting series, such as Dsv5, after checking the guest and security prerequisites with room for the host plus an inner VM or two. Give it enough RAM: the inner VM needs its own memory on top of the host OS, so a 2-vCPU / 8 GB size that's fine for a single workload will feel cramped once you're nesting. From an elevated PowerShell session on the guest:

# 1. Install the Hyper-V role + management tools, then reboot Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart # --- after the VM comes back up --- # 2. Create an internal switch for the inner VMs New-VMSwitch -Name "NestedSwitch" -SwitchType Internal # 3. Give the inner VMs a way out: NAT behind the host New-NetIPAddress -IPAddress 192.168.100.1 -PrefixLength 24 ` -InterfaceAlias "vEthernet (NestedSwitch)" New-NetNat -Name "NestedNat" ` -InternalIPInterfaceAddressPrefix 192.168.100.0/24 # 4. Create the inner VM (attach the installation ISO afterwards) New-VM -Name "inner-01" -MemoryStartupBytes 4GB ` -Generation 2 -NewVHDPath "C:\VMs\inner-01.vhdx" -NewVHDSizeBytes 40GB ` -SwitchName "NestedSwitch" # 5. Attach your own installation ISO before booting Add-VMDvdDrive -VMName "inner-01" -Path "C:\ISO\guest.iso"

The networking step is the one people skip and then wonder why their inner VM can't reach the internet. An internal switch has no path to the outside on its own. The NAT rules above give the inner VMs a private subnet and route them out through the host's connection — for a lab that's usually all you want. If you'd rather hand out addresses automatically, run a small DHCP scope on the host, or just assign static IPs inside each inner VM. From here it's ordinary Hyper-V: connect a console, boot the ISO, install the guest OS.

Windows Sandbox / WSL2 shortcut

If your goal is Windows Sandbox or WSL2 rather than full Hyper-V management, you don't need the switch and NAT dance. On a nesting-capable VM, enable the relevant Windows feature (Containers-DisposableClientVM for Sandbox, or wsl --install for WSL2), reboot, and the platform handles its own inner virtualization. Same size requirement, far less setup.

What it costs you — overhead and limits

There's no separate charge for nesting. You pay the normal compute, storage, and egress on the outer Azure VM, and the inner VMs run on hardware you already rent. But the real cost is capacity: every inner VM's vCPU and RAM come out of the host's allocation, so a nesting host is almost always a larger, pricier size than the same job would need without nesting. Budget the host to fit the host OS plus every inner VM you plan to run at once, with headroom.

Performance takes a hit too. Running a hypervisor inside a hypervisor adds a layer of translation, so inner VMs are measurably slower than the same VM running directly on Azure. For a lab, a build agent, or a test cluster that's a non-issue. For anything latency-sensitive or throughput-heavy, it's a reason to reach for a native design instead. And the hard limit worth repeating: one level of nesting only. Your inner VMs cannot run their own working hypervisor. If your scenario needs three layers, Azure won't give it to you.

It's a lab bench, not a foundation. Build on it, learn on it, don't run production under it.

Common questions

Which Azure VM sizes support nested virtualization?

Check the exact series feature table and Hyper-V guest prerequisites. Dsv5 is a documented example. Support can vary across processor architecture, constrained or specialized sizes, and security configuration; newer D/E naming alone is not a compatibility guarantee.

Why won't my nested VM start on Azure?

Check VM-series support, guest OS prerequisites, security configuration and available memory. A firmware check alone does not establish compatibility. A supported size change may be possible, so do not assume every failure requires redeployment. Then check the inner guest boot media and network configuration.

Can you nest virtualization more than one level deep on Azure?

No. Azure exposes one level of nesting. You can run Hyper-V inside an Azure VM and start guests inside that, but those guests cannot themselves run a working hypervisor. If your lab needs nested-in-nested, Azure is not the platform for it.

Is nested virtualization free on Azure?

There is no separate charge for the feature. You pay the normal compute, storage, and egress for the outer Azure VM — and because you need enough RAM and vCPU for both the host and the inner VMs, you usually pay for a larger size than a single-workload VM. The inner VMs run on hardware you already rent, so they add no line item of their own.

Read next
Your next step
You came here with a job to do. Here is the next piece of it.
Do it once for realApp Service Plan & Slot Swap — a real Azure lab · ~20 min · a few cents · Cloud Shell.
Or sit the paperAZ-104 practice set — 300 questions, marked with reasoning.

Every class is open to read. A free account saves your progress. Azure resources used for labs may incur charges.

Filed under Azure · How-to. Next note: Compute on Azure — the whole map →

Sources and review

Reviewed 1 October 2026. The PowerShell sequence is a lab example and has not been executed in a paid subscription. Assign an address, gateway and DNS inside the inner guest; the NAT commands do not create DHCP.