有谁知道在Azure Devops发布管道中通过- 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'))]",发布于 2021-03-29 06:30:31
问题是我使用的是Devops管道的发布特性,而不是yaml。当我在UI中选择参数json文件时,它引入了所有参数,甚至是没有在参数文件中显式指定的参数。我不想显式地设置这个参数,所以它将使用默认值。喜欢,
"utcShort": {
"type": "string",
"defaultValue": "[utcNow('d')]"
},所以,我不得不从参数列表中删除这个utcShort参数,所以它将使用缺省值。否则,Devops会用引号将其括起来,并将其视为字符串。
https://stackoverflow.com/questions/66833829
复制相似问题