更新时间:2022-05-28 03:16:54
只需创建一个取决于参数的变量:
just create a variable that would depend on the parameter:
"parameters": {
...
"DeploymentType": {
"type": "string",
"allowedValues": [
"Dev",
"Prod"
]
}
...
"variables": {
"Dev": "https://some_service-ci.domain.com",
"Prod": "https://abc123.foo.bar.baz.com",
"DeploymentVariable": "[variables(parameters('DeploymentType'))]",
...
"appSettings": [
"name": "MY_SERVICE_URL",
"value": "[variables('DeploymentVariable')]"
]
...
好的,这是怎么工作的.您传入参数"DeploymentType",它可以是PROD或DEV.如果您通过DEV "DeploymentVariable": "[variables(parameters('DeploymentType'))]",
-这将得出"[variables('Dev')]"
并获得"Dev": "https://some_service-ci.domain.com",
Ok, so how does this work. you pass in the parameter 'DeploymentType', it can be PROD or DEV. If you pass DEV "DeploymentVariable": "[variables(parameters('DeploymentType'))]",
- this evaluates to "[variables('Dev')]"
and gets the value of "Dev": "https://some_service-ci.domain.com",