此 Azure Pipelines 构建 yaml 模板中的 'azureRmConnection.Id' 是什么,我该如何使用它?
What is 'azureRmConnection.Id' in this Azure Pipelines build yaml template and how do I use it?
问题总结
我正在尝试构建项目并将其部署到 Azure Web 应用程序。我已经设置了 Azure Web App。对于构建管道,我采用了来自 Microsoft 的以下构建 YAML 模板:
我不知道 YAML 模板的 variables
部分中的 {{ azureRmConnection.Id }}
指的是什么或如何使用它。
背景
双括号 ({{ }}
) 语法用于计算表达式,而管道变量使用美元 ($()
) 语法引用。所以我认为 azureRmConnection
是构建应该已经可以访问的东西,而不是需要设置管道变量。
我试过的
搜索了 Microsoft 的文档,Google 和 Whosebug。
查看我的 Azure Web 应用程序以尝试找到任何明显的东西。
添加 Web 应用程序的订阅 ID 作为对名称为 azureRmConnection.Id
.
的管道的变量引用
关于双括号语法的参考 Ansible YAML 语法文档:https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
密码
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: '{{ azureRmConnection.Id }}'
预期和实际结果
预计
我希望构建具有有效的 azureRmConnection.Id
,因此不会因为它丢失或无效而失败。
实际
构建失败并出现以下错误:
There was a resource authorization issue: "The pipeline is not valid. Job Deploy: Step input azureSubscription references service connection {{ azureRmConnection.Id }} which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."
您需要做的是按照 this link 并创建一个 AzureRm 服务连接并使用其名称代替该占位符:
azureSubscription: 'my-azurerm-connection-name-goes-here'
我尝试使用 'Node.js React Web App to Linux on Azure' 向导创建新管道。我确实认为我已经尝试过了,但我之前一定使用过不同的方法。这还有几个阶段。
向导允许我从下拉菜单中选择我的 Azure Web 应用程序和 Azure 订阅。
现在 YAML 中的变量如下所示:
variables:
azureSubscription: '1234xx56-xx7x-[...]'
webAppName: 'my-azure-web-app-name'
environmentName: 'my-azure-web-app-name'
azureSubscription
是我的 Azure 订阅 ID。
webAppName
是我之前在 Azure 门户上设置的 Azure Web 应用程序的名称。
构建现已 运行 成功。
问题总结
我正在尝试构建项目并将其部署到 Azure Web 应用程序。我已经设置了 Azure Web App。对于构建管道,我采用了来自 Microsoft 的以下构建 YAML 模板:
我不知道 YAML 模板的 variables
部分中的 {{ azureRmConnection.Id }}
指的是什么或如何使用它。
背景
双括号 ({{ }}
) 语法用于计算表达式,而管道变量使用美元 ($()
) 语法引用。所以我认为 azureRmConnection
是构建应该已经可以访问的东西,而不是需要设置管道变量。
我试过的
搜索了 Microsoft 的文档,Google 和 Whosebug。
查看我的 Azure Web 应用程序以尝试找到任何明显的东西。
添加 Web 应用程序的订阅 ID 作为对名称为
azureRmConnection.Id
. 的管道的变量引用
关于双括号语法的参考 Ansible YAML 语法文档:https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
密码
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: '{{ azureRmConnection.Id }}'
预期和实际结果
预计
我希望构建具有有效的 azureRmConnection.Id
,因此不会因为它丢失或无效而失败。
实际
构建失败并出现以下错误:
There was a resource authorization issue: "The pipeline is not valid. Job Deploy: Step input azureSubscription references service connection {{ azureRmConnection.Id }} which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."
您需要做的是按照 this link 并创建一个 AzureRm 服务连接并使用其名称代替该占位符:
azureSubscription: 'my-azurerm-connection-name-goes-here'
我尝试使用 'Node.js React Web App to Linux on Azure' 向导创建新管道。我确实认为我已经尝试过了,但我之前一定使用过不同的方法。这还有几个阶段。
向导允许我从下拉菜单中选择我的 Azure Web 应用程序和 Azure 订阅。
现在 YAML 中的变量如下所示:
variables:
azureSubscription: '1234xx56-xx7x-[...]'
webAppName: 'my-azure-web-app-name'
environmentName: 'my-azure-web-app-name'
azureSubscription
是我的 Azure 订阅 ID。
webAppName
是我之前在 Azure 门户上设置的 Azure Web 应用程序的名称。
构建现已 运行 成功。