How to create Windows 10 VM using Azure CLI

Saurabh Suman 20 Reputation points

I have been using following query but do not get VM created

az vm create --resource-group <RG Name> --name name --image 'Windows' --admin-username "username" --vnet-name vnet--subnet subnet --nsg NSG --nic-delete-option Delete --public-ip-address ""  --security-type Standard

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,570 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,082 questions
{count} votes

Accepted answer
  1. TP 74,786 Reputation points

    Hi Saurabh,

    I tested below command for creating Windows 10 VM using Azure CLI and it worked (MyResourceGroup already existed):

    az vm create --resource-group MyResourceGroup --name my-vm --image "MicrosoftWindowsDesktop:Windows-10:win10-22h2-ent-g2:latest" --admin-username "username" --vnet-name vnet --subnet subnet --nsg NSG --nic-delete-option Delete --public-ip-address "" --security-type Standard

    Please click Accept Answer and upvote if the above was helpful.



    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Anveshreddy Nimmala 2,150 Reputation points Microsoft Vendor

    Hello Saurabh Suman,

    Welcome to the microsoft Q&A, Thankyou for posting your query here.

    please find the below documentations for creating VM using CLI.


    Hope this helps you,

    If an answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!


    0 comments No comments

  2. Yanhong Liu 1,550 Reputation points Microsoft Vendor

    Hello Saurabh Suman,

    There are some places to pay attention to in the Azure CLI command of Windows 10 VM. First of all, there are some syntax errors in your command. For example, VNET-Subnet should be VNet-Name <Virtual Network Name>-SUBNET <subnet name>. In addition, -Image 'Windows' requires a specific Windows 10 image name. Please refer to the following commands:

    az vm create \

      --resource-group myResourceGroup \

      --name myVM \

      --image MicrosoftWindowsDesktop:Windows-10-Enterprise:version:20h2-pro:2021.04.12 \

      --admin-username myAdminUser \

      --admin-password mySecurePassword \

      --vnet-name myVNet \

      --subnet mySubnet \

      --nsg myNetworkSecurityGroup \

      --public-ip-address "" \

      --security-type Standard

    Please note that the above URN is a fictional example, not the real Windows 10 image URN. The actual URN shall be obtained through the AZ VM Image List command.

    You can use the following command:

    az vm image list --offer Windows-10-enterprise --all --output table.

    Best Regards,

    Yanhong Liu


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments