部署ARM模板时要更改的JSON参数
我使用Azure DevOps部署我的ARM模板 我有一个YAML文件,它执行bash代码:部署ARM模板时要更改的JSON参数,json,azure,azure-devops,yaml,Json,Azure,Azure Devops,Yaml,我使用Azure DevOps部署我的ARM模板 我有一个YAML文件,它执行bash代码: bash./deploy\u eventhubs.sh 在deploy.eventhubs.sh中,我执行以下命令: az deployment group create --resource-group myresourcegroup --templatefile armtemp/eventhubs.json --parameters @eventhubs-params.json 在我的两个模板中:
bash./deploy\u eventhubs.sh
在deploy.eventhubs.sh
中,我执行以下命令:
az deployment group create --resource-group myresourcegroup --templatefile armtemp/eventhubs.json --parameters @eventhubs-params.json
在我的两个模板中:
- eventhubs.json
- eventhubs-params.json
{“value”:“${LOCATION}”},
我想更改运行时。每个用例的位置不同,所以我很好奇,在YAML或Bash中,如何预定义这两个JSON文件使用的这个参数
有用资源:文档建议您可以使用参数JSON文件(如上所述),然后在运行时覆盖它:
az deployment group create --resource-group testrg --name rollout01 \
--template-file azuredeploy.json --parameters @params.json \
--parameters https://mysite/params.json --parameters MyValue=This MyArray=@array.json
因此,可以设想有两种方法:使用希望使用的扩展变量值构造JSON文件或文字JSON字符串,并将其作为一个附加的--parameters项附加,或者将整个命令动态构造为一个字符串,嵌入$(变量)引用,然后执行它(这有一定的shell注入风险)