Nested virtualization in Azure

Copper Contributor

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 document

In the step **Configure Nested Virtualization**, I am running the below command after updating the VM name. I am 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 the documentation mentions executing it when the system is in the OFF state.
While in the **Run Command** pane, it is not letting execute the command if the machine is in the OFF state.

What I am doing wrong?

The VM is of type **Standard D4as v4**

 

6 Replies
AMD servers does not support nested virtualization in Azure. See documentation: https://learn.microsoft.com/en-us/azure/virtual-machines/dav4-dasv4-series

I would sugguest you to change the VM size to D4s_v5 to support nested virtualization scenarios.

@abhi2689 

Seems this is not support yet

@fmartel Please help with this point also as how to run the command.
The documentation says to run it when the VM is in stopped state. While I run to execute the command under 'Run Command' section, it is mentioned that VM must be ON.

I have never installed docker desktop, so I don't know what is the enduser experience.

So I think it is because you misunderstood the guide or I misunderstand the need.

I assume it is a some kind of manager that leverage Hyper-V container virtualization and the manager need to have virtualization extensions enabled during the install of during the container creation.

 

The thing is.. Set-VMProcessor is intended to be ran on a hyper-v host that as a stoped VM.

When ExposeVirtualizationExtensions is set to true to a VM, it allow this vm to run virtualization technologies on this VM. (Hyper-V)

 

So in your scenario the VM (Standard D4as v4) is managed by Microsoft in Azure and this VM have ExposeVirtualizationExtensions value set to false because nested virtualization is not supported on AMD servers in Azure. You must dealocate your VM, change the VM size to a VM size that support nested virtualization. After that you can install hyper-v in that VM and you should be able to spin a nested VM/container in that VM. Set ExposeVirtualizationExtensions to the new VM/container created would allow this child VM to run another hyper-V host inside.. which is a pretty much uncommon scenario.

 

Hope it make sense.

@fmartel: Sorry I failed to communicate clearly.
I resized my VM as per your suggestion.

As per the document, I am supposed to execute the Set-VMProcessor command.

My question is where to execute the command.

The reason for the confusion is because of the following:
1. the document suggests that it has to be executed when the VM is in the stopped state.
In the Azure portal, for a VM, I see the option to execute this command 'Run Command' window. This window mentions that the command can be executed only when VM is running.

2. If I run this command from the 'Run Command' window or inside the VM, I get the error that it couldn't find the VM.

So this is nothing to do with docker till now. It is just Azure VM and nested virtualization.
@fmartel: Sorry for disturbing you again and again.
I have achieved the nested virtualization following https://learn.microsoft.com/en-us/azure/lab-services/how-to-enable-nested-virtualization-template-vm... on the VM size you had suggested.

Thank you for being there.