Share via

Deployment template validation failed

汶徽 何 0 Reputation points
2026-02-20T06:58:47.93+00:00

Azure virtual machine deployment failed. I dont know what is 'subnetId'
{

"code": "InvalidTemplate",

"message": "Deployment template validation failed: 'The value for the template parameter 'subnetId' at line '1' and column '1821' is not provided. Please see https://aka.ms/arm-create-parameter-file for usage details.'.",

"additionalInfo": [

{

  "type": "TemplateViolation",

  "info": {

    "lineNumber": 1,

    "linePosition": 1821,

    "path": "properties.template.parameters.subnetId"

  }

}

]

}

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Nikhil Duserla 9,685 Reputation points Microsoft External Staff Moderator
    2026-02-20T08:25:52.51+00:00

    Hello @汶徽 何 ,

    In additional to TP, This error indicates that your ARM/Bicep template defines a required parameter named subnetId, but no value was supplied during deployment.

    The subnetId parameter must contain the fully qualified Azure resource ID of the subnet into which the virtual machine’s network interface will be deployed. When provisioning a VM, Azure requires explicit network placement information so it can associate the VM’s NIC with the correct virtual network and subnet.

    A valid subnet resource ID follows this format: /subscriptions/<subscriptionId>/resourceGroups/<rgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>

    Get your subnet id-

    az network vnet subnet show \
      --resource-group <rgName> \
      --vnet-name <vnetName> \
      --name <subnetName> \
      --query id -o tsv
    

    Add it to your parameters file-

    { "parameters": { "subnetId": { "value": "/subscriptions/xxxx/resourceGroups/xxxx/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/MySubnet" } } }

    Please let us know if you require any further assistance. I’d be happy to help. Thank you!

    0 comments No comments

  2. TP 151.7K Reputation points Volunteer Moderator
    2026-02-20T07:02:04.99+00:00

    Hi,

    There is a bug in the Marketplace Free VM offer that causes this error. What you can do is manually create VM using correct parameters to qualify for free. To start the process you may use link below (this is for Windows with notes for Linux VM after):

    https://portal.azure.com/#create/Microsoft.VirtualMachine

    For Windows, when creating, set

    • Size: Standard_B2ats_v2
    • Image: [smalldisk] Windows Server 2022 Datacenter: Azure Edition Core - x64 Gen2
    • OS disk size: 64 GiB (P6)
    • OS disk type: Premium SSD (locally-redundant storage)
    • Monitoring tab: Boot diagnostics: Disable

    NOTE: Above is for core edition of Windows Server, so no graphical interface. If you want GUI you may choose [smalldisk] Windows Server 2022 Datacenter: Azure Edition - x64 Gen2 instead.

    Don't enable any of the options if you want to avoid charges, for example, if you turned on Backup that has a charge associated with it.

    After creating VM, please monitor costs (at least daily) by navigating to your subscription. If you used correct parameters for the VM you should not see any charges accrue related to it, except for the public IP address. Charges are delayed, so it will take typically several hours (after creation) before any would show up.

    If you associate Public IP address with the VM you will be charged for this (about $3.65/month each). You can minimize the charges by dissociating it from the VM's network interface and deleting it when you are not using the VM.

    When you want to use VM again you would create Public IP and associate it with VM's network interface.

    For Linux you would use Ubuntu Server 22.04 LTS - x64 Gen2 or other free Linux image with P6 LRS disk.

    After creating Windows VM you should expand disk so you are using full 64 GiB:

    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/expand-disks

    After creating Linux VM you should expand the partition so you are using the full 64 GiB:

    https://learn.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks?tabs=ubuntu#expand-a-disk-partition-and-filesystem

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

    Thanks.

    -TP

    0 comments No comments

Your answer

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