In our last post, we explored troubleshooting ‘convertfrom-json’ with ARM templates. Which boiled down to comments in your JSON files.

As per RFC 4627, comments with JSON aren’t supported (aren’t part of the standard). Only objects, resources etc. are.

What you need to do, is add a custom property “comment” like so. This comment won’t be visible in the azure portal, and only for reference in your templates:

      
{
        
"apiVersion": "2015-08-01",
        
"name": "[variables('WebAppName')]",
        
"type": "Microsoft.Web/sites",
        
"location": "[resourceGroup().location]",
        
"tags": {
          
"displayName": "Website",
          
"DeployedBy": "[parameters('DeployedBy')]",
          
"DeployedDate": "[parameters('DeployedDate')]"
        
},
        
"dependsOn": [
          
"[concat('Microsoft.Web/serverfarms/', variables('AppPlan'))]",
          
"[concat('Microsoft.Cache/Redis/', variables('RedisCache'))]"
        
],
        
"properties": {
          
"comment": "Here is a comment for you to view",
          
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('AppPlan'))]",
          
"clientAffinityEnabled": false
        
}
  

Note: This does NOT work for certain resource-types!

  • Microsoft.SQL