ARM template deployment error

steven 20 Reputation points
2025-11-12T01:40:40.7166667+00:00

I'm trying to deploy a basic Linux VM and I'm receiving an error message.

<the error message has been moved to Private Message>

I'm not sure what is wrong on the template, everything looks to be correct.

Template in comments, thanks

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

Answer accepted by question author
  1. Ankit Yadav 6,425 Reputation points Microsoft External Staff Moderator
    2025-11-12T03:20:08.3866667+00:00

    Hello @steven I've done some changes like api-version and fixed few syntax errors and it's working fine for me, can you retry your deployment using below ARM template and let me know if works out for you:

    {
        "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "vmName": {
                "defaultValue": "<masked>",
                "type": "String",
                "metadata": {
                    "description": "The name of your Virtual Machine."
                }
            },
            "adminUsername": {
                "defaultValue": "<masked>",
                "type": "String",
                "metadata": {
                    "description": "Username for the Virtual Machine."
                }
            },
            "authenticationType": {
                "defaultValue": "sshPublicKey",
                "allowedValues": [
                    "sshPublicKey",
                    "password"
                ],
                "type": "String",
                "metadata": {
                    "description": "Type of authentication to use on the Virtual Machine. SSH key is recommended."
                }
            },
            "adminPublicKey": {
                "defaultValue": "",
                "type": "String",
                "metadata": {
                    "description": "OpenSSH PUBLIC key (single line) used when authenticationType=sshPublicKey. Example: ssh-ed25519 AAAAC3... user@host"
                }
            },
            "adminPassword": {
                "defaultValue": "",
                "type": "SecureString",
                "metadata": {
                    "description": "Password used when authenticationType=password."
                }
            },
            "dnsLabelPrefix": {
                "defaultValue": "[toLower(format('{0}-{1}', parameters('vmName'), parameters('stage')))]",
                "type": "String",
                "metadata": {
                    "description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
                }
            },
            "ubuntuOSVersion": {
                "defaultValue": "Ubuntu-2004",
                "allowedValues": [
                    "Ubuntu-2004",
                    "Ubuntu-2204"
                ],
                "type": "String",
                "metadata": {
                    "description": "The Ubuntu version for the VM (Gen2)."
                }
            },
            "location": {
                "defaultValue": "[resourceGroup().location]",
                "type": "String",
                "metadata": {
                    "description": "Location for all resources."
                }
            },
            "stage": {
                "defaultValue": "dev",
                "allowedValues": [
                    "test",
                    "dev",
                    "prod"
                ],
                "type": "String",
                "metadata": {
                    "description": "Environment stage name for deployment."
                }
            },
            "vmSize": {
                "defaultValue": "Standard_B1s",
                "type": "String",
                "metadata": {
                    "description": "The size of the VM."
                }
            },
            "virtualNetworkName": {
                "defaultValue": "<masked>",
                "type": "String",
                "metadata": {
                    "description": "Name of the VNET."
                }
            },
            "subnetName": {
                "defaultValue": "<masked>",
                "type": "String",
                "metadata": {
                    "description": "Name of the subnet in the virtual network."
                }
            },
            "networkSecurityGroupName": {
                "defaultValue": "<masked>",
                "type": "String",
                "metadata": {
                    "description": "Name of the Network Security Group."
                }
            },
            "securityType": {
                "defaultValue": "TrustedLaunch",
                "allowedValues": [
                    "Standard",
                    "TrustedLaunch"
                ],
                "type": "String",
                "metadata": {
                    "description": "Security Type of the Virtual Machine."
                }
            }
        },
        "variables": {
            "imageReference": {
                "Ubuntu-2004": {
                    "publisher": "Canonical",
                    "offer": "0001-com-ubuntu-server-focal",
                    "sku": "20_04-lts-gen2",
                    "version": "latest"
                },
                "Ubuntu-2204": {
                    "publisher": "Canonical",
                    "offer": "0001-com-ubuntu-server-jammy",
                    "sku": "22_04-lts-gen2",
                    "version": "latest"
                }
            },
            "publicIPAddressName": "[format('{0}PublicIP', parameters('vmName'))]",
            "networkInterfaceName": "[format('{0}NetInt', parameters('vmName'))]",
            "osDiskType": "Standard_LRS",
            "subnetAddressPrefix": "*.*.*.*/24",
            "addressPrefix": "*.*.*.*/16",
            "linuxConfiguration": {
                "disablePasswordAuthentication": true,
                "ssh": {
                    "publicKeys": [
                        {
                            "path": "[format('/home/{0}/.ssh/authorized_keys', parameters('adminUsername'))]",
                            "keyData": "[parameters('adminPublicKey')]"
                        }
                    ]
                }
            },
            "securityProfileJson": {
                "uefiSettings": {
                    "secureBootEnabled": true,
                    "vTpmEnabled": true
                },
                "securityType": "[parameters('securityType')]"
            },
            "extensionName": "GuestAttestation",
            "extensionPublisher": "Microsoft.Azure.Security.LinuxAttestation",
            "extensionVersion": "1.0",
            "maaTenantName": "GuestAttestation",
            "maaEndpoint": "[substring('emptystring', 0, 0)]"
        },
        "resources": [
            {
                "type": "Microsoft.Network/networkSecurityGroups",
                "apiVersion": "2020-11-01",
                "name": "[parameters('networkSecurityGroupName')]",
                "location": "[parameters('location')]",
                "properties": {
                    "securityRules": [
                        {
                            "name": "SSH",
                            "properties": {
                                "priority": 1000,
                                "protocol": "Tcp",
                                "access": "Allow",
                                "direction": "Inbound",
                                "sourceAddressPrefix": "*",
                                "sourcePortRange": "*",
                                "destinationAddressPrefix": "*",
                                "destinationPortRange": "22"
                            }
                        }
                    ]
                }
            },
            {
                "type": "Microsoft.Network/virtualNetworks",
                "apiVersion": "2020-11-01",
                "name": "[parameters('virtualNetworkName')]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]"
                ],
                "properties": {
                    "addressSpace": {
                        "addressPrefixes": [
                            "[variables('addressPrefix')]"
                        ]
                    },
                    "subnets": [
                        {
                            "name": "[parameters('subnetName')]",
                            "properties": {
                                "addressPrefix": "[variables('subnetAddressPrefix')]",
                                "networkSecurityGroup": {
                                    "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]"
                                },
                                "privateEndpointNetworkPolicies": "Enabled",
                                "privateLinkServiceNetworkPolicies": "Enabled"
                            }
                        }
                    ]
                }
            },
            {
                "type": "Microsoft.Network/publicIPAddresses",
                "apiVersion": "2020-11-01",
                "name": "[variables('publicIPAddressName')]",
                "location": "[parameters('location')]",
                "sku": {
                    "name": "Standard"
                },
                "properties": {
                    "publicIPAllocationMethod": "Static",
                    "publicIPAddressVersion": "IPv4",
                    "dnsSettings": {
                        "domainNameLabel": "[parameters('dnsLabelPrefix')]"
                    },
                    "idleTimeoutInMinutes": 4
                }
            },
            {
                "type": "Microsoft.Network/networkInterfaces",
                "apiVersion": "2020-11-01",
                "name": "[variables('networkInterfaceName')]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]",
                    "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]",
                    "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
                ],
                "properties": {
                    "ipConfigurations": [
                        {
                            "name": "ipconfig1",
                            "properties": {
                                "subnet": {
                                    "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]"
                                },
                                "privateIPAllocationMethod": "Dynamic",
                                "publicIPAddress": {
                                    "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
                                }
                            }
                        }
                    ],
                    "networkSecurityGroup": {
                        "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]"
                    }
                }
            },
            {
                "type": "Microsoft.Compute/virtualMachines",
                "apiVersion": "2022-08-01",
                "name": "[parameters('vmName')]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
                ],
                "properties": {
                    "hardwareProfile": {
                        "vmSize": "[parameters('vmSize')]"
                    },
                    "storageProfile": {
                        "imageReference": "[variables('imageReference')[parameters('ubuntuOSVersion')]]",
                        "osDisk": {
                            "createOption": "FromImage",
                            "managedDisk": {
                                "storageAccountType": "[variables('osDiskType')]"
                            }
                        }
                    },
                    "networkProfile": {
                        "networkInterfaces": [
                            {
                                "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
                            }
                        ]
                    },
                    "osProfile": {
                        "computerName": "[parameters('vmName')]",
                        "adminUsername": "[parameters('adminUsername')]",
                        "adminPassword": "[if(equals(parameters('authenticationType'), 'password'), parameters('adminPassword'), json('null'))]",
                        "linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), json('null'), variables('linuxConfiguration'))]"
                    },
                    "securityProfile": "[if(equals(parameters('securityType'), 'TrustedLaunch'), variables('securityProfileJson'), json('null'))]"
                }
            },
            {
                "type": "Microsoft.Compute/virtualMachines/extensions",
                "apiVersion": "2022-08-01",
                "name": "[format('{0}/{1}', parameters('vmName'), variables('extensionName'))]",
                "location": "[parameters('location')]",
                "dependsOn": [
                    "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]"
                ],
                "properties": {
                    "publisher": "[variables('extensionPublisher')]",
                    "type": "[variables('extensionName')]",
                    "typeHandlerVersion": "[variables('extensionVersion')]",
                    "autoUpgradeMinorVersion": true,
                    "enableAutomaticUpgrade": true,
                    "settings": {
                        "AttestationConfig": {
                            "MaaSettings": {
                                "maaEndpoint": "[variables('maaEndpoint')]",
                                "maaTenantName": "[variables('maaTenantName')]"
                            }
                        }
                    }
                },
                "condition": "[and(and(equals(parameters('securityType'), 'TrustedLaunch'), variables('securityProfileJson').uefiSettings.secureBootEnabled), variables('securityProfileJson').uefiSettings.vTpmEnabled)]"
            }
        ],
        "outputs": {
            "adminUsername": {
                "type": "String",
                "value": "[parameters('adminUsername')]"
            },
            "hostname": {
                "type": "String",
                "value": "[reference(resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName')), '2020-11-01').dnsSettings.fqdn]"
            },
            "sshCommand": {
                "type": "String",
                "value": "[format('ssh {0}@{1}', parameters('adminUsername'), reference(resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName')), '2020-11-01').dnsSettings.fqdn)]"
            }
        }
    }
    

    Please note that I've change the default names to <masked> to avoid sharing the resource names here and removed the IP addresses with * due to security reasons.


1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2025-11-12T01:40:50.8966667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message you're encountering indicates that the ARM template is trying to reference a property called securityProfile in the vm.properties object, but this property does not exist. This typically occurs when the template is using an incorrect or outdated schema for the virtual machine resource.

    Here are a few steps you can take to troubleshoot and resolve the issue:

    1. Check the ARM Template Schema: Ensure that your ARM template is using the correct schema version for the VM resource. You can find the latest schema documentation on the Azure documentation site.
    2. Review the Properties: Verify that the properties defined in your ARM template match the expected properties for the VM resource type. If securityProfile is not a valid property for the VM configuration you are using, you will need to remove or correct it.
    3. Validate the Template: Use a tool like Visual Studio Code with the Azure Resource Manager Tools extension to validate your template. This can help identify any syntax or structural issues.
    4. Consult Documentation: Refer to the Azure documentation for the specific VM configuration you are trying to deploy to ensure all required properties are correctly defined.

    By following these steps, you should be able to identify and fix the issue in your ARM template.

    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.