question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Comments in arm templates makes the template invalid

See original GitHub issue

Copied 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:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bmoore-msftcommented, Apr 7, 2020

The Azure Marketplace allows comments in ARM templates…

0reactions
anthony-c-martincommented, Apr 7, 2020

@edburns Current comment behavior is documented here.

I’m checking with @bmoore-msft regarding your question on marketplace support.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found