How to escape single quote in ARM template

前端 未结 4 1114
天涯浪人
天涯浪人 2020-12-16 10:58

Given the following resource in an AzureRM template, how would one encode the single quote in the commandToExecute part?



        
4条回答
  •  猫巷女王i
    2020-12-16 11:12

    it is not necessary encode the single quote in the commandToExecute part. The json segment below has been validated as valid json in http://jsonlint.com/

    {
        "type": "Microsoft.Compute / virtualMachines / extensions ",
        "name": "[concat(variables('vmNameMaster'), copyIndex(), '/sethost')]",
        "apiVersion": "2015-06-15",
        "location": "[resourceGroup().location]",
        "copy": {
            "name": "extensionLoopNode",
            "count": "[variables('masterCount')]"
        },
        "dependsOn": [
            "[concat('Microsoft.Compute/virtualMachines/', variables('vmNameMaster'), copyIndex(),'/extensions/DockerExtension')]"
        ],
        "properties": {
            "publisher": "Microsoft.OSTCExtensions",
            "type": "CustomScriptForLinux",
            "typeHandlerVersion": "1.4",
            "settings": {
                "fileUris": [],
                "commandToExecute": "[concat('/bin/bash -c 'echo \"export DOCKER_HOST=:2375\" >> /home/', parameters('adminUsername') ,'/.profile'')]",
                "timestamp": 123456789
            }
        }
    }
    

提交回复
热议问题