作为模板文件的一部分,我们有一个由 deployment 方法的deployment().name
,与此类似:
"myVariable": "[concat(SOME_CUSTOM_STRING_HERE, deployment().name)]"
变量是 then用作我们的经典云服务资源的部署标签,其中包括内部版本号。
{
"apiVersion": "2015-12-01",
"type": "deploymentSlots",
"name": "staging",
"properties": {
"deploymentLabel": "[variables('myVariable')]",
...
},
...
}
也许deployment().name
可以由Azure设置而不是定义,但我一直无法找到它。
但是,在云服务扩展支持下,该变量的值有所不同。这次,该值是一个长哈希值和云服务资源的名称,尽管定义仍然如上所示。该变量在标签中使用:
{
"apiVersion": "2021-03-01",
"type": "Microsoft.Compute/cloudServices",
"name": "RESOURCE_NAME",
"location": "[LOCATION]",
"tags": {
"DeploymentLabel": "[variables('myVariable')]",
...
},
...
}
那么部署云服务的扩展支持版本时,deployment().name
模板函数的值是否发生变化?如果不能的话可以设置吗?如何设置?
As part of our template files, we have a variable defined partially by deployment method's deployment().name
, similar to this:
"myVariable": "[concat(SOME_CUSTOM_STRING_HERE, deployment().name)]"
The variable is then used as the deployment label for our Classic Cloud Service resources which includes the build number.
{
"apiVersion": "2015-12-01",
"type": "deploymentSlots",
"name": "staging",
"properties": {
"deploymentLabel": "[variables('myVariable')]",
...
},
...
}
Perhaps deployment().name
can be set and not defined by Azure, but I haven't been able I haven't been able to find it.
However, the variable's value is different under Cloud Service Extended Support. This time the value is a long hash and the name of the Cloud Service resource, even thought the definition remains as shown above. The variable is used in a tag:
{
"apiVersion": "2021-03-01",
"type": "Microsoft.Compute/cloudServices",
"name": "RESOURCE_NAME",
"location": "[LOCATION]",
"tags": {
"DeploymentLabel": "[variables('myVariable')]",
...
},
...
}
So did the value of deployment().name
template function change for deployments of Extended Support version of cloud service? If not, can it be set and how?
发布评论
评论(2)
从 Azure Devops 端来看,如果您正在运行部署,则任务本身具有部署名称,例如部署模式。如果未提供,则会自动生成
部署模式:'增量'
部署名称:“部署名称”
如果是 powershell,请检查下面的链接
https: //learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-cli#azure-deployment-template-name
From the Azure Devops side, if you are running the deployment the task itself has the deployment name like deployment mode. if its not provided, automatically it gets generated
deploymentMode: 'Incremental'
deploymentName: 'deploymentname'
if its powershell then please check the link below
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-cli#azure-deployment-template-name
您在部署资源时设置名称:
you set the name when you deploy a resource: