前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >手工修复Azure DevOps无法连接到Azure的问题

手工修复Azure DevOps无法连接到Azure的问题

作者头像
Edi Wang
发布2019-07-09 09:54:34
1.4K0
发布2019-07-09 09:54:34
举报
文章被收录于专栏:汪宇杰博客汪宇杰博客

今天我在为一个从TFVC迁移到Git的老项目重新配置发布到Azure App Service的CI/CD管线的时候,Azure DevOps竟然爆了。这是一个微软已知的bug,目前还未修复,我来带大家看看如何手工workaround这个问题。

首先,部署的时候报错消息如下:

Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resourcename 'moonglade'. Error: Could not fetch access token for Managed ServicePrincipal. Please configure Managed Service Identity (MSI) for virtual machine'https://aka.ms/azure-msi-docs'.Status code: 400, status message: Bad Request

本质上是因为Azure DevOps到Azure的连接无效,或者过期了。但是当我尝试重新认证的时候,竟然又爆了:

TF14045: The identity with type 'Microsoft.IdentityModel.Claims.ClaimsIdentity' could not be found.

对此,微软有个已知bug可以追踪:https://developercommunity.visualstudio.com/content/problem/412380/tf14045-the-identity-with-type-microsoftidentitymo-1.html

解决方法

进入 Azure Active Directory > App registrations (Preview)

点击 "+ New registration"

指定一个 Name,如 ediwang-AzureDevOps

选择 "Accounts in this organizational directory only"

Redirection URL 填: https://VisualStudio/SPN

Description 任意,Expires 建议选 Never

然后把 Client Secrets 里的密钥复制出来

还有Overview 里的 Application (client) ID 以及 Directory (tenant) ID

然后到 Subscription > Access control (IAM) 里搜索刚才创建的App名字,搜到以后,Add a role assignment

然后安排一个 Owner,Azure这边就搞定了!

然后回到 Azure DevOps

Azure App Service Deploy 的任务里点 Manage

Service Connections 里添加一个 Azure Resource Manager

然后点“use the full version of the service connection dialog.

选择和输入对应的值。其中 Service pricipal client ID 就是刚才复制的 Application (client) IDService pricipal key 就是刚才 Client Secrets 里复制的 VALUE

最后点击 Verify connection,不成功便成仁!

到此为止,就全部搞定了。重新回到你的部署任务里,就能成功选择目标Azure App Service上的网站了,并且能部署成功。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-02-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 汪宇杰博客 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
CODING DevOps
CODING DevOps 一站式研发管理平台,包括代码托管、项目管理、测试管理、持续集成、制品库等多款产品和服务,涵盖软件开发从构想到交付的一切所需,使研发团队在云端高效协同,实践敏捷开发与 DevOps,提升软件交付质量与速度。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档