How can I enable nested virtualization for a Ubuntu VM which I created in Azure?

Faheem Awan 0 Reputation points
2024-12-21T18:52:11.98+00:00

I have create a VM of Ubuntu 20.04. I want to enable nested virtualization, which I am not able to to do. I am using the Standard D2s v3 (2 vcpus, 8 GiB memory) which supports nested virtualization. I have also selected the US central which supports nested virtualization.

When I am try to do it via Azure cli it gives error

az vm update --resource-group oaitest --name oai --set "additionalCapabilities.enableNestedVirtualization=true"
Property 'enableNestedVirtualization' not found on additionalCapabilities. Send it as an additional property .
(BadRequest) Could not find member 'enableNestedVirtualization' on object of type 'AdditionalCapabilities'. Path 'properties.additionalCapabilities.enableNestedVirtualization', line 1, position 628.
Code: BadRequest
Message: Could not find member 'enableNestedVirtualization' on object of type 'AdditionalCapabilities'. Path 'properties.additionalCapabilities.enableNestedVirtualization', line 1, position 628.
Target: vm.properties.additionalCapabilities.enableNestedVirtualization

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,487 questions
{count} votes

2 answers

Sort by: Most helpful
  1. hossein jalilian 10,100 Reputation points
    2024-12-21T19:13:09.6866667+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    Nested virtualization is already enabled by default on Ubuntu VMs in Azure, including Ubuntu 20.04. You don't need to manually enable it for your Ubuntu VM. To verify if nested virtualization is enabled, you can follow these steps:

    Connect to your Ubuntu VM using SSH, run the following command to check if the required kernel module is loaded:

    lsmod | grep -i kvm
    
    cat /sys/module/kvm_intel/parameters/nested
    
    

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful

    0 comments No comments

  2. Prrudram-MSFT 27,961 Reputation points
    2024-12-31T09:31:23.7533333+00:00

    Hi Faheem Awan

    I am unable to see the o/p on the above message. Can you share a screenshot of it?

    If you are trying this from scratch, this might help https://brianlinkletter.com/2018/06/create-a-nested-virtual-machine-in-a-microsoft-azure-linux-vm/

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.