How to escape single quote in ARM template

前端 未结 4 1113
天涯浪人
天涯浪人 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条回答
  •  情深已故
    2020-12-16 11:15

    I've worked around this with a variable:

    "variables": {
        "singleQuote": "'",
    },
    ...
    "settings": {
        "fileUris": [],
        "commandToExecute": "[concat('/bin/bash -c ', variables('singleQuote'), 'echo \"export DOCKER_HOST=:2375\" >> /home/', parameters('adminUsername') ,'/.profile', variables('singleQuote'))]",
    }
    

    It isn't elegant but it works.

提交回复
热议问题