Azure Devops 发布管道 - ARM - utcNow
Azure Devops Release Pipeline - ARM - utcNow
有谁知道在通过 Azure Devops 发布管道中的 - task: AzureResourceManagerTemplateDeployment@3
部署时,谁让 utcNow 像文档 (https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-date?tabs=json#examples-1) 所说的那样作为默认参数工作?
这在通过本地 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'))]",
问题是我使用的是 Devops 管道的发布功能,而不是 yaml。当我在 UI 中选择参数 json 文件时,它会引入所有参数,甚至是参数文件中未明确指定的参数。我不想显式设置此参数,因此它将使用默认值。喜欢,
"utcShort": {
"type": "string",
"defaultValue": "[utcNow('d')]"
},
所以,我不得不从参数列表中删除这个 utcShort 参数,这样它就会使用默认值。否则 Devops 将其用引号括起来并将其视为字符串。
有谁知道在通过 Azure Devops 发布管道中的 - task: AzureResourceManagerTemplateDeployment@3
部署时,谁让 utcNow 像文档 (https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-date?tabs=json#examples-1) 所说的那样作为默认参数工作?
这在通过本地 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'))]",
问题是我使用的是 Devops 管道的发布功能,而不是 yaml。当我在 UI 中选择参数 json 文件时,它会引入所有参数,甚至是参数文件中未明确指定的参数。我不想显式设置此参数,因此它将使用默认值。喜欢,
"utcShort": {
"type": "string",
"defaultValue": "[utcNow('d')]"
},
所以,我不得不从参数列表中删除这个 utcShort 参数,这样它就会使用默认值。否则 Devops 将其用引号括起来并将其视为字符串。