Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, March 8, 2018 6:47 PM
I keep getting the error "Deployment template parse failed: 'Required property 'type' not found in JSON. Path 'parameters.environment' ... " when deploying an ARM template referencing additional nested templates. All are ok if deployed separately. The issue only started after adding the 4th nested template reference. Any ARM nested template deployment limit i should know of?
All replies (7)
Wednesday, March 14, 2018 6:37 PM âś…Answered
Sorry for the delayed response. The only odd thing I can see is that you have the "type" property as the last item in each parameter, this really shouldn't matter and I just tested it and it worked fine for me configured like that, but if you have an older version of Azure PowerShell or similar then it may be related. You could try updating or just swapping the values around to see if it helps. The error message does seem to indicate an issue with the type value in the parameter.
Sam Cogan Microsoft Azure MVP
Blog | Twitter
Thursday, March 8, 2018 7:49 PM
Can you post the ARM template you are trying to run?
Sam Cogan Microsoft Azure MVP
Blog | Twitter
Thursday, March 8, 2018 10:19 PM
Sure. I appreciate any help you may provide.
Master Template:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"_artifactsLocation": {
"defaultValue": "https://XXXX.blob.core.windows.net/corevnetwepd-stageartifacts",
"type": "string"
},
"_artifactsLocationSasToken": {
"type": "securestring",
"metadata": {
"description": "Auto-generated token to access _artifactsLocation",
"artifactsLocationSasToken": ""
},
"defaultValue": ""
},
"environment": {
"type": "string",
"metadata": {
"description": "Environment to provision"
},
"defaultValue": "stg"
}
},
"resources": [
{
"apiVersion": "2017-05-10",
"name": "NetworkResources",
"type": "Microsoft.Resources/deployments",
"dependsOn": [],
"properties": {
"mode": "Incremental",
"parametersLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
},
"templateLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
}
},
"resourceGroup": "XXXX-core-rg-stg"
},
{
"apiVersion": "2017-05-10",
"name": "KeyVault",
"type": "Microsoft.Resources/deployments",
"dependsOn": [],
"properties": {
"mode": "Incremental",
"parametersLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
},
"templateLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
}
},
"resourceGroup": "XXXX-kv-rg-stg"
},
{
"apiVersion": "2017-05-10",
"name": "DomainControllers",
"type": "Microsoft.Resources/deployments",
"dependsOn": [
"NetworkResources",
"KeyVault"
],
"properties": {
"mode": "Incremental",
"parametersLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
},
"templateLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
}
},
"resourceGroup": "XXXX-dc-rg-stg"
},
{
"apiVersion": "2017-05-10",
"name": "RDSBrokers",
"type": "Microsoft.Resources/deployments",
"dependsOn": [
"NetworkResources",
"KeyVault",
"DomainControllers"
],
"properties": {
"mode": "Incremental",
"parametersLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
},
"templateLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
}
},
"resourceGroup": "XXXX-brk-rg-stg"
},
{
"apiVersion": "2017-05-10",
"name": "RDSGateways",
"type": "Microsoft.Resources/deployments",
"dependsOn": [
"NetworkResources",
"KeyVault",
"DomainControllers"
],
"properties": {
"mode": "Incremental",
"parametersLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
},
"templateLink": {
"contentVersion": "1.0.0.0",
"uri": "https://XXXX"
}
},
"resourceGroup": "XXXX-rdg-rg-stg"
}
],
"variables": {}
}
Nested template who triggers error > 4th processed (RDSBrokers):
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"imageOffer": {
"defaultValue": "WindowsServer",
"metadata": {
"description": "Image Offer"
},
"type": "string"
},
"imagePublisher": {
"defaultValue": "MicrosoftWindowsServer",
"metadata": {
"description": "Image Publisher"
},
"type": "string"
},
"imageSKU": {
"defaultValue": "2016-Datacenter",
"metadata": {
"description": "Image SKU"
},
"type": "string"
},
"projectName": {
"defaultValue": "XXXX",
"metadata": {
"description": "Name of storage account"
},
"type": "string"
},
"role": {
"defaultValue": "brk",
"metadata": {
"description": "Name of storage account"
},
"type": "string"
},
"secretLocalAdminName": {
"defaultValue": "XXXX",
"type": "string"
},
"secretLocalAdminPass": {
"type": "securestring"
},
"subnetNamePrefix": {
"defaultValue": "XXXX-adm-sn-brk",
"type": "string"
},
"vmSize": {
"defaultValue": "Standard_D2s_v3",
"metadata": {
"description": "Size of the VM"
},
"type": "string"
},
"vmStorageType": {
"defaultValue": "Premium_LRS",
"metadata": {
"description": "Managed disk storage account type"
},
"type": "string"
},
"vnetNamePrefix": {
"defaultValue": "XXXX-adm-vn",
"type": "string"
},
"vnetResourceGroupPrefix": {
"defaultValue": "XXXX-core-rg",
"type": "string"
}
},
"resources": [
{
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"name": "[variables('diagStorageAccountName')]",
"properties": {
"accountType": "[variables('diagStorageAccountType')]"
},
"type": "Microsoft.Storage/storageAccounts"
},
{
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"name": "[variables('availabilitySetName')]",
"properties": {
"managed": true,
"platformFaultDomainCount": 2,
"platformUpdateDomainCount": 2
},
"type": "Microsoft.Compute/availabilitySets"
},
{
"apiVersion": "2017-10-01",
"location": "[resourceGroup().location]",
"name": "[variables('publicIPAddressName')]",
"type": "Microsoft.Network/publicIPAddresses",
"properties": {
"dnsSettings": {
"domainNameLabel": "[variables('dnsNameforLBIP')]"
},
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
}
},
{
"apiVersion": "2017-10-01",
"copy": {
"count": "[variables('numberOfInstances')]",
"name": "nicLoop"
},
"dependsOn": [
"[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(variables('nicNamePrefix'), copyindex(1),'-nic1','-',variables ('env'))]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"loadBalancerBackendAddressPools": [
{
"id": "[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]"
}
],
"loadBalancerInboundNatRules": [
{
"id": "[concat(variables('lbID'),'/inboundNatRules/RDP-VM', copyindex(1))]"
}
],
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('existingSubnetRef')]"
}
}
}
]
},
"type": "Microsoft.Network/networkInterfaces"
},
{
"apiVersion": "2017-10-01",
"type": "Microsoft.Network/loadBalancers",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
],
"location": "[resourceGroup().location]",
"name": "[variables('lbName')]",
"properties": {
"backendAddressPools": [
{
"name": "BackendPool1"
}
],
"frontendIPConfigurations": [
{
"name": "LoadBalancerFrontEnd",
"properties": {
"publicIPAddress": {
"id": "[variables('publicIPAddressID')]"
}
}
}
],
"inboundNatRules": [
{
"name": "RDP-VM1",
"properties": {
"backendPort": 3389,
"enableFloatingIP": false,
"frontendIPConfiguration": {
"id": "[variables('frontEndIPConfigID')]"
},
"frontendPort": 50001,
"protocol": "Tcp"
}
},
{
"name": "RDP-VM2",
"properties": {
"backendPort": 3389,
"enableFloatingIP": false,
"frontendIPConfiguration": {
"id": "[variables('frontEndIPConfigID')]"
},
"frontendPort": 50002,
"protocol": "Tcp"
}
}
],
"loadBalancingRules": [
{
"name": "LBRule",
"properties": {
"backendAddressPool": {
"id": "[variables('lbPoolID')]"
},
"backendPort": 80,
"enableFloatingIP": false,
"frontendIPConfiguration": {
"id": "[variables('frontEndIPConfigID')]"
},
"frontendPort": 80,
"idleTimeoutInMinutes": 5,
"probe": {
"id": "[variables('lbProbeID')]"
},
"protocol": "Tcp"
}
}
],
"probes": [
{
"name": "TcpProbe",
"properties": {
"intervalInSeconds": 5,
"numberOfProbes": 2,
"port": 80,
"protocol": "Tcp"
}
}
]
}
},
{
"apiVersion": "2017-03-30",
"copy": {
"count": "[variables('numberOfInstances')]",
"name": "virtualMachineLoop"
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('diagStorageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicNamePrefix'), copyindex(1),'-nic1','-',variables ('env'))]",
"[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(variables('vmNamePrefix'), copyindex(1),'-',variables ('env'))]",
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('http://',variables('diagStorageAccountName'),'.blob.core.windows.net')]"
}
},
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicNamePrefix'), copyindex(1),'-nic1','-',variables ('env')))]"
}
]
},
"osProfile": {
"adminPassword": "[parameters('secretLocalAdminPass')]",
"adminUsername": "[parameters('secretLocalAdminName')]",
"computerName": "[concat(variables('vmNamePrefix'), copyindex(1),'-stg')]"
},
"storageProfile": {
"imageReference": {
"offer": "[parameters('imageOffer')]",
"publisher": "[parameters('imagePublisher')]",
"sku": "[parameters('imageSKU')]",
"version": "latest"
},
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage",
"diskSizeGB": 128,
"managedDisk": {
"storageAccountType": "[parameters('vmStorageType')]"
},
"name": "[concat(variables('vmNamePrefix'), copyindex(1),'-osdisk1','-',variables ('env'))]",
"osType": "Windows"
}
}
},
"type": "Microsoft.Compute/virtualMachines"
}
],
"variables": {
"availabilitySetName": "[concat(parameters('projectName'),'-',parameters('role'),'-','as','-',parameters('env'))]",
"azuresubscription_prd": "XXXX",
"azuresubscription_stg": "XXXX",
"diagStorageAccountName": "[concat(parameters('projectName'),parameters('role'),'diag',parameters('env'))]",
"diagStorageAccountType": "Standard_LRS",
"dnsNameforLBIP": "[concat(parameters('projectName'),parameters('role'),'lbpip',parameters('env'))]",
"existingSubnetRef": "[concat(variables('existingVnetID'),'/subnets/',parameters ('subnetNamePrefix'),'-',variables ('env'))]",
"existingVnetID": "[concat('/subscriptions/',variables('azuresubscription_stg'),'/resourceGroups/',parameters ('vnetResourceGroupPrefix'),'-',variables ('env'),'/providers/Microsoft.Network/virtualNetworks/',parameters ('vnetNamePrefix'),'-',variables ('env'))]",
"frontEndIPConfigID": "[concat(variables('lbID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]",
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]",
"lbName": "[concat(parameters('projectName'),'-',parameters('role'),'-lb-',parameters('env'))]",
"lbPoolID": "[concat(variables('lbID'),'/backendAddressPools/BackendPool1')]",
"lbProbeID": "[concat(variables('lbID'),'/probes/TcpProbe')]",
"nicNamePrefix": "[concat(parameters('projectName'),'-',parameters('role'),'0')]",
"numberOfInstances": 2,
"publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]",
"publicIPAddressName": "[concat(parameters('projectName'),'-',parameters('role'),'-pip-',parameters('env'))]",
"publicIPAddressType": "Dynamic",
"vmNamePrefix": "[concat(parameters('projectName'),parameters('role'),'0')]"
}
}
Parameter File:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"imageOffer": {
"value": "WindowsServer"
},
"imagePublisher": {
"value": "MicrosoftWindowsServer"
},
"imageSKU": {
"value": "2016-Datacenter"
},
"projectName": {
"value": "XXXX"
},
"role": {
"value": "brk"
},
"secretLocalAdminName": {
"value": "XXXX"
},
"secretLocalAdminPass": {
"value": "MovetoKeyvault"
},
"vmStorageType": {
"value": "Premium_LRS"
},
"subnetNamePrefix": {
"value": "XXXX-adm-sn-brk"
},
"vmSize": {
"value": "Standard_D2s_v3"
},
"vnetNamePrefix": {
"value": "XXXX-adm-vn"
},
"vnetResourceGroupPrefix": {
"value": "XXXX-core-rg"
}
}
}
Thursday, March 8, 2018 10:28 PM | 2 votes
In your nested template you refer to both a variable and a parameter called "env" this is not declared anywhere.
Sam Cogan Microsoft Azure MVP
Blog | Twitter
Friday, March 9, 2018 10:47 AM
The files I posted where from a test version where i was not yet finished transitioning env/environment from a parameter to a variable. After converting it a variable the error is still present, but referencing the first parameter that is described in the template.
Now the error message is:
2018-03-09T10:22:25.3592141Z ##[error]BadRequest: {
"error": {
"code": "InvalidTemplate",
"message": "Deployment template parse failed: 'Required property 'type' not found in JSON. Path 'parameters.imageOffer', line 7, position 6.'."
}
} undefined
2018-03-09T10:22:25.3593774Z ##[error]BadRequest: {
"error": {
"code": "InvalidTemplate",
"message": "Deployment template parse failed: 'Required property 'type' not found in JSON. Path 'parameters.imageOffer', line 7, position 6.'."
}
} undefined
Tuesday, March 13, 2018 6:22 PM
For a deeper analysis of this issue, I would suggest you open a support ticket as described in this link How to create an Azure support request. The ticket will help you work closely with the support for speedy resolution.
Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.
Thursday, March 15, 2018 10:15 AM
The issue happens both during deployment with VSTS (hosted build agents) and local deployment with up-to-date Powershell modules.
I also already tried reverting the order of the values to the default, non A-Z, with not success. I will open a support case and let you know the outcome.