我必须部署2个资源,并且具有如下的ARM模板:
SELECT REGEXP_REPLACE(str,'(.* )(\d+)(.*)','\2') AS download_speed,
REGEXP_REPLACE(str,'(.*\/)(\d+)(.*)','\2') AS upload_speed
FROM tab
Test.json如下所示:
Template.json
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2018-05-01",
"name": "Resource1",
"properties": {
"templateLink": {
"uri": "Test.json"
},
"parameters": {
"secretA": { "value": "" },
"secretB": { "value": "" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2018-05-01",
"name": "Resource2",
"properties": {
"templateLink": {
"uri": "Test.json"
},
"parameters": {
"secretC": { "value": "" },
"secretD": { "value": "" },
"secretE": { "value": "" }
}
}
}
我需要在(Resource1)的appSettings中设置(i)secretA,secretB(ii)在Resource2的appsettings中设置secretC,secretD,secretE。
如何更新上述ARM模板,以在appSettings中使用正确的秘密部署Resource1和Resource2?
例如:
Resource1 appSettings应该如下所示:
Test.json
"resources":
{
"apiVersion": "2018-02-01",
"type": "Microsoft.Web/sites",
"name": "",
"properties": {
"appSettings": {
//set secrets in this section
}
}
Resource2 appSettings应该如下所示:
"appSettings": {
{
"name": "secretA",
"value": ""
},
{
"name": "secretB",
"value": ""
}
}
答案 0 :(得分:1)
您可以添加一个数组参数。例如
resource1的参数如下
"parameters": {
"secretSettings": {
"value": [
{
"name": "secretA",
"value": "",
"slotSetting": false
},
{
"name": "secretB",
"value": "",
"slotSetting": false
}
]
}
}
resource2的参数如下
"parameters": {
"secretSettings": {
"value": [
{
"name": "secretC",
"value": "",
"slotSetting": false
},
{
"name": "secretD",
"value": "",
"slotSetting": false
}
]
}
}
然后,您可以在资源模板中引用该参数。
"appSettings": "[parameters('secretSettings')]"
请帮助我理解-设置所有 每次部署test.json时都要使用appSettings吗?
这意味着新的appSettings将覆盖现有的appSettings,您应该在每次部署时在参数中添加所需的所有appSettings。