使用AZ CLI传递参数进行ARM模板部署

huangapple go评论77阅读模式
英文:

Passing parameters using AZ CLI for ARM template deployment

问题

我正在尝试使用az group deployment create执行ARM模板部署,并希望传递参数,其中的值在变量中定义。我可以使用以下语法轻松完成单个参数而无任何问题:

--parameters parameter1=$var1

但是,当我尝试使用以下语法添加其他参数时,它会失败:

--parameters parameter1=$var1, parameter2=$var2

以下语法也会失败,因为它不会使用变量的值:

--parameters '{
    "parameter1": { "value": "$var1" },
    "parameter2": { "value": "$var2" }
}'

有人知道我试图做的是否可能,以及正确的语法是什么吗?

英文:

I am trying to use az group deployment create to perform an ARM template deployment and I want to pass in parameters where the values are defined in variables. I can do a single parameter with no issues using the syntax below:

--parameters parameter1=$var1

But when I try to add additional parameters using the syntax below, it fails:

--parameters parameter1=$var1, parameter2=$var2

The syntax below fails as well since it will not use the values of the variables:

    --parameters '{
        "parameter1": { "value": "$var1" },
        "parameter2": { "value": "$var2" }
    }'

Does anyone know if what I am trying to do is possible and what the correct syntax would be?

答案1

得分: 1

以下是要翻译的内容:

我正在应对一个受损的外壳和略微不正确的语法的组合。我尝试完成的正确语法如下:

--parameters parameter1=$var1 parameter2=$var2

或者,如果涉及多个参数时要更清晰:

--parameters parameter1=$var1 `
    parameter2=$var2 `
    parameter3=$var3
英文:

I was fighting a combination of a corrupt shell and slightly incorrect syntax. The correct syntax for what I was trying to do is listed below:

--parameters parameter1=$var1 parameter2=$var2

Or, for a cleaning view when several parameters are involved:

--parameters parameter1=$var1 `
    parameter2=$var2 `
    parameter3=$var3

huangapple
  • 本文由 发表于 2020年1月4日 00:40:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/59582176.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定