简体   繁体   English

Azure DevOps 发布管道每次都失败

[英]Azure DevOps Release Pipeline Fails Every Time

Currently, trying to configure a release pipeline in Azure Devops.目前,正在尝试在 Azure Devops 中配置发布管道。 I've successfully created a CI pipeline that is working and running tests successfully.我已经成功创建了一个正在运行并成功运行测试的 CI 管道。 My release pipeline uses the artifacts from latest the CI build and should be deploying to azure.我的发布管道使用来自最新 CI 构建的工件,应该部署到 azure。 When I look at the logs I can see the the following were completed successfully:当我查看日志时,我可以看到以下内容已成功完成:

  • Initialize Agent初始化代理
  • Initialize job初始化作业
  • Download arifact下载神器

and then the "Deploy to Azure App Service" fails with the logs showing the following details:然后“部署到 Azure 应用服务”失败,日志显示以下详细信息:

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

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.我通过从管道阶段 1 的模板中选择Azure App Service deployment来创建发布管道(我只有一个阶段),并且我添加了一个来自我的构建管道的工件。 I then selected the Tasks tab and selected my Pay-as-you-go subscription under "Available Azure Service Connections".然后我选择了“任务”选项卡,并在“可用的 Azure 服务连接”下选择了我的即用即付订阅。 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:我去了:

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.项目设置 -> 服务连接 -> 新服务连接 -> 选定的 azure 资源管理器 -> 选定的服务主体身份验证代替托管身份验证 -> 弹出一个允许我登录并授权的弹出窗口。

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.然后我在创建发布管道时使用了该服务连接,而不是我上次使用的预先存在的现收现付订阅。

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.这导致了“无法授权帐户”错误消息,这就是我首先使用托管身份验证的原因。

In my case, it was related to a chrome extension I have added 'enable CORS' plugin.就我而言,它与我添加了“启用 CORS”插件的 chrome 扩展有关。 After disabling, release pipeline worked nicely禁用后,发布管道运行良好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM