【发布时间】:2021-06-24 06:42:16
【问题描述】:
有谁知道在 Azure Devops Release 管道中通过 - task: AzureResourceManagerTemplateDeployment@3 进行部署时,像文档 (https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-date?tabs=json#examples-1) 所说的那样,让 utcNow 作为默认参数工作吗?
在本地通过 powershell 部署时,这可以正常工作。但是在 Azure Devops 中使用该任务,它不会翻译 utcNow 函数?
标签以字符串表示形式出现。即
我将标签构建为变量。即
//参数文件
"resourceTags": {
"value": {
"Environment": "Dev",
"ApplicationName": "MyApp"
}
},
// 参数
"utcShort": {
"type": "string",
"defaultValue": "[utcNow('d')]"
},
"resourceTags": {
"type": "object"
},
// 变量
"lastDeployed": {
"LastDeployed": "[parameters('utcShort')]"
},
"resourceTags": "[union(parameters('resourceTags'), variables('lastDeployed'))]",
【问题讨论】:
-
你是如何设置
utcShort参数的? -
对不起,我想我错过了那个重要的部分。我已经更新了问题,但它是默认值。即``` "utcShort": { "type": "string", "defaultValue": "[utcNow('d')]" },
-
配置或您的任务是什么样的? (截图?)
标签: azure azure-devops azure-resource-manager