Comments in arm templates makes the template invalid
See original GitHub issueCopied from @sjkp closed issue 2112. (RIP Neil Peart).
I’ll add that Visual Studio Code supports comments in JSON.
If an ARM template contains comments (//) with containing / the template deployment will fail.
I have a ARM template that looks like this:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sitename": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"siteLocation": {
"type": "string"
},
"sku": {
"type": "string",
"defaultValue": "f1",
"metadata": {
"description": "The hosting plan sku"
}
},
"tier": {
"type": "string",
"defaultValue": "Free",
"allowedValues": [
"Free",
"Shared",
"Basic",
"Standard",
"Premium"
],
"metadata": {
"description": "the pricing tier"
}
}
},
"resources": [
{
"apiVersion": "2015-08-01",
"location": "[parameters('siteLocation')]",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"properties": {
"name": "[parameters('hostingPlanName')]",
"numberOfWorkers": 1
},
"sku": {
"name": "[parameters('sku')]",
"tier": "[parameters('tier')]"
}
},
//Comments Microsoft.Web/serverfarms --
{
"apiVersion": "2015-08-01",
"location": "[parameters('siteLocation')]",
"name": "[parameters('sitename')]",
"type": "Microsoft.Web/sites",
"dependsOn": [ "[concat('Microsoft.Web/serverFarms/', parameters('hostingPlanName'))]" ],
"properties": {
"name": "[parameters('sitename')]",
"serverFarmId": "[parameters('hostingPlanName')]"
}
}
]
}
When i try to deploy it with: azure group create -n website -l westeurope -f website.json -e website.param.dev.json -d website
I get the following error info: Executing command group create
Getting resource group sjkpwebsite Updating resource group sjkpwebsite info: Updated resource group sjkpwebsite Initializing template configurations and parameters error: Unexpected token /
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Comments in arm templates makes the template invalid #2112
If an ARM template contains comments (//) with containing / the template deployment will fail. I have a ARM template that looks like...
Read more >Invalid template errors - Azure Resource Manager
This article describes how to resolve invalid template errors for Bicep files and Azure Resource Manager templates (ARM templates).
Read more >Error & Fix: ARM Linked Template 'Invalid Template .. could ...
In my ARM template development, I am trying to deploy an Azure SQL Server PaaS resource and Key Vault. This is so that...
Read more >The template reference 'not valid error in arm template
I am deploying resource group using arm templates.
Read more >How to troubleshoot Azure Resource Manager (ARM ...
Deploying Azure Resource Manager (ARM) templates with the Azure PowerShell ... template validation errors (Code=InvalidTemplateDeployment).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The Azure Marketplace allows comments in ARM templates…
@edburns Current comment behavior is documented here.
I’m checking with @bmoore-msft regarding your question on marketplace support.