WSL2 on Azure Windows 10 VM

Ian Foulds 6 Reputation points

I am evaluating a Windows 10 2004 VM on Azure but need to run my distro as a WSL2 instance for performance reasons. Git and grep are painful on WSL1.

I cannot get the Hyper-V features installed required to run WSL2. Running the following fails with the errors shown:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
The term 'Install-WindowsFeature' is not recognized as the name of a cmdlet

Import-module servermanager
The specified module 'servermanager' was not loaded because no valid module file was found in any module directory.

This is looking very much like nested virtualisation on an Azure VM is not going to work, in which case this project is dead in the water.

Am I missing something or is MS purposefully preventing developers from running the latest, and IMHO brilliant, features for WSL.

Many thanks.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
6,304 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Leon Laude 85,486 Reputation points


    You'll need to choose an Azure VM size that is capable of nested virtualization, check for the SKU Family with Hyper-threaded and capable of running nested virtualization:

    Azure compute unit (ACU)

    More information here:

    How to enable nested virtualization in an Azure VM

    Best regards,

    2 people found this answer helpful.

  2. Ian Foulds 6 Reputation points

    I recreated the VM and it was still failing with exactly the same errors. Then I remembered that things were different when I did this on my local machine a while back, the commands for installing Hyper-V on Windows 10 are not the same:

    It now works!!

    1 person found this answer helpful.

  3. Ian Foulds 6 Reputation points

    Hi Leon

    I was aware of how to enable the nested HV, that's what led me to my original post as it didn't work. I was however unfamiliar with the list of sizes that supported nested HV, many thanks for that although most are well outside the budget for a WSL2 development machine.

    I have changed the VM size to D2s_v3 but I stall can't enable nested VMs, the commands still report the same errors as my original post. Do I need to reload the OS to pick up the changes? I hope I don't need to trash the VM and start again as I got charged £25 just for provisioning it.

    Many thanks

  4. Ian Foulds 6 Reputation points

    Thanks Leon, I'll try a reload. It has to be the latest W10 release V2004 to support WSL2. Previously this was only available via the Windows Insiders program. I've been using it locally here for some time and just updated to the final release. I need to move to a cloud solution for other reasons.

    0 comments No comments