Nested virtualization in Azure

Publish date: 2024-05-09

I am trying to run Docker Desktop in an Azure VM. The Azure VM has Windows 10 Pro as the OS.

So, I am following this Azure document

In the step Configure Nested Virtualization, I am running the below command after updating the VM name. I ma executing as PowerShell script under Run command pane.

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true 

I am getting the following error.

Set-VMProcessor : Hyper-V was unable to find a virtual machine with name 

I have noticed that documentation mentions executing it when the system is in the OFF state. While in the Run Command pane, it is not letting to execute the command if the machine is in the OFF state.

What I am doing wrong?

The VM is of type Standard D4as v4

1 Answer

To Enable Nested virtualization in Azure, Make use of below command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart Install -WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature 

enter image description here

Enable Hyper-V with PowerShell and DISM:

DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V 

enter image description here

Now, when I tried the same command, I got the same error like below:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true 

enter image description here

Make sure you have correctly replaced VMName with the actual name of your Azure VM in the command. You can check the name of your VM in the Azure portal or by running the following command Get-AzVM like below:

Go to Server manager -> Tools -> Hyper-V manager -> VM you can see the name of the virtual machine that you want to enable nested virtualization.

Run the Set-VMProcessor command with the -VMName parameter set to the name of the virtual machine got result successfully like below:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true 

enter image description here

Reference:

windows - Docker : Hyper-V was unable to find a virtual switch with name "DockerNAT" - Stack Overflow by leopal

0

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobm9tY2iBeYGOp5ysrJWZere10a2smqSZr661tc6nZKKmXZbHtr7E