Hello Rishabh,
It looks like your VM size support nested virtualization beside that you can follow this guide (https://techcommunity.microsoft.com/blog/itopstalkblog/how-to-setup-nested-virtualization-for-azure-vmvhd/1115338) Here a summarized guide to troubleshoot the WSL2 error on your Azure VM:
- Enable Nested Virtualization: Use the command
az vm update --resource-group <rg-name> --name <vm-name> --set additionalCapabilities.nestedVirtualization=true. Stop and restart the VM if needed. - Install WSL Features: Run
wsl --install --no-distributioninside the VM. If needed, enable "Virtual Machine Platform" withdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartand reboot. - Verify BIOS Virtualization: Ensure that VT-x or AMD-V is enabled for the VM. Recreate the VM if necessary.
- Test WSL: Confirm WSL2 is working with
wsl --list --verboseand set default version withwsl --set-default-version 2. - Check Logs: Use
wsl --updateandwsl --statusfor debugging.
References:
If the information helped address your question, please Accept the answer. Luis