每次Azure DevOps发布管道都会失败 [英] Azure DevOps Release Pipeline Fails Every Time

本文介绍了每次Azure DevOps发布管道都会失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,尝试在Azure Devops中配置发布管道.我已经成功创建了一个CI管道,该管道成功地运行和运行了测试.我的发布管道使用了来自最新CI构建的工件,应该将其部署到Azure.当我查看日志时,可以看到以下内容已成功完成:

Currently, trying to configure a release pipeline in Azure Devops. I've successfully created a CI pipeline that is working and running tests successfully. My release pipeline uses the artifacts from latest the CI build and should be deploying to azure. When I look at the logs I can see the the following were completed successfully:

  • 初始化代理
  • 初始化工作
  • 下载arifact

,然后部署到Azure应用服务"失败,日志显示以下详细信息:

and then the "Deploy to Azure App Service" fails with the logs showing the following details:

2019-02-07T19:06:57.5433805Z Got service connection details for Azure App Service:'MyApp'
2019-02-07T19:06:57.5487495Z ##[error]Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'MyAPP'. Error: Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: 400, status message: Bad Request
2019-02-07T19:06:57.5496340Z Failed to add release annotation. TypeError: Cannot read property 'getApplicationSettings' of undefined

到目前为止,我在此方面找不到很多帮助.我通过从管线第1阶段的模板中选择Azure App Service deployment创建了发布管道(我只有一个阶段),并添加了一个源于我的构建管道的工件.然后,我选择了任务"选项卡,并在可用的Azure服务连接"下选择了按需购买"订阅.选择我的订阅后,我的应用程序服务名称在应用程序服务名称"下拉列表中变为可用,并且我选择了它.然后,我点击保存并尝试创建一个发行版,但是每个发行版均失败,并显示上述错误消息.

I haven't been able to find much to help with this so far. I created the release pipeline by selecting Azure App Service deployment from the templates for stage 1 of the pipline (I only have one stage) and I added an artifact who's source is from my build pipeline. I then selected the Tasks tab and selected my Pay-as-you-go subscription under "Available Azure Service Connections". After selecting my subscription, my app service name became available in the "App service name" dropdown and I selected it. I then hit save and tried to create a release but every release fails with the above error message.

我该怎么做才能克服这个问题?

What can I do to overcome this?

推荐答案

终于找到了解决我问题的方法.问题出在我建立服务连接的方式上.我去了:

Finally found a solution to my issue. The problem was in the way I set up my service connection. I went to:

项目设置->服务连接->新服务连接->选择azure资源管理器->选择服务主体身份验证INSTEAD OF受管身份验证->出现一个弹出窗口,允许我登录并进行授权.

project settings -> service connections -> new service connection -> selected azure resource manager -> selected service principal authentication INSTEAD OF managed identity authentication -> a popup came up that allowed me to log in and authorize.

然后,我在创建发布管道时使用了该服务连接,而不是我上次使用的现有的现收现付订阅.

Then I used that service connection when creating the release pipeline instead of the pre-existing Pay-As-You-Go subscription that I used last time.

以前,当我尝试此操作时,我运行了一个adblocker,它阻止了弹出窗口,当我选择服务主体身份验证时,该弹出窗口允许我进行授权.导致出现无法授权帐户"错误消息,这就是为什么我首先使用托管身份验证的原因.

Previously when I tried this, I had an adblocker running and it blocked the popup which allowed me to authorize when I selected service principal authentication. That resulted in an "Unable to authorize account" error message which is why I went with managed identity authentication in the first place.

这篇关于每次Azure DevOps发布管道都会失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆