简体   繁体   English

从不同的VSTS帐户进行Azure持续部署

[英]Azure continuous deployment from different VSTS account

I'm trying to setup continuous deployment via the Aure Portal. 我正在尝试通过Aure Portal设置持续部署。

When doing this via the VSTS account (let's call it "VSTS Account A") which is owned by the same account owner as Azure, everything works fine. 当通过VSTS帐户(我们称之为“VSTS帐户A”)执行此操作时,该帐户由与Azure相同的帐户所有者拥有,一切正常。

In this case I'm trying to configure continuous deploymenet from source code held in another VSTS account (let's go with Account B). 在这种情况下,我正在尝试从另一个VSTS帐户中保存的源代码配置连续deploymenet(让我们使用帐户B)。

The Azure account owner is not the Account B owner but is an admin (member of Organization Administrators) for Account B. The owner is also listed explicitly as a member of at least one project within Account B. Azure帐户所有者不是帐户B所有者,而是帐户B的管理员(组织管理员的成员)。所有者也明确列为帐户B中至少一个项目的成员。

The problem is that when it commes to configuring "Deployment source" within the app service section, Account B is not listed as an option to choose from. 问题在于,当它在应用服务部分中配置“部署源”时,帐户B不会作为可供选择的选项列出。

I've followed various links (eg part 4 of this page ) about linking the VSTS account with an Azure account but still no joy. 我已经关注了各种链接(例如本页的第 4部分)关于将VSTS帐户与Azure帐户相关联但仍然没有乐趣。 There are a couple of problems here: 这里有几个问题:

  • The Azure classic portal has a New button within the Visual Studio Team Services section but when I choose Link To Existing, I get the following message: Azure经典门户在Visual Studio Team Services部分中有一个New按钮,但是当我选择Link To Existing时,我收到以下消息:

    Make sure you're the account owner. 确保您是帐户所有者。 If you are, maybe your account is linked to another Azure subscription or connected to another Azure Active Directory 如果您是,可能您的帐户已链接到另一个Azure订阅或连接到另一个Azure Active Directory

    Account B is not linked to another Azure Subscription or Azure AD. 帐户B 链接到另一个Azure订阅或Azure AD。

  • The new portal doesn't even have an option to attempt to link a different account, plus the menu link says "Team Services Account Preview" so whether the Preview status has something to do with it, I don't know. 新门户甚至没有选择尝试链接其他帐户,加上菜单链接显示“团队服务帐户预览”,所以预览状态是否与它有关,我不知道。

I'd have thought this would be a relatively common use case, has anyone had any joy setting up something similar? 我曾经认为这将是一个相对常见的用例,有没有人有任何喜欢设置类似的东西?

I was finally able to choose the relevant account by making the VSTS principal a co-admin in the Azure account which contains the web app, signing in as that user and changing the directory to use from the the user dropdown menu (top-right). 我终于能够通过使VSTS负责人成为Azure帐户中的共同管理员来选择相关帐户,该帐户包含Web应用程序,以该用户身份登录并从用户下拉菜单更改要使用的目录(右上角) 。 Note, the user account in question is already an administrator for a different Azure account, just to complicate matters further. 请注意,有问题的用户帐户已经是其他Azure帐户的管理员,只是为了进一步复杂化。 I only had the option to change the directory once the user was a member of multiple directories. 一旦用户是多个目录的成员,我只能选择更改目录。

So I finally got it configured and committing code to the specified branch was triggering a deploy. 所以我最终配置它并将代码提交到指定的分支正在触发部署。 However, it transpires that setting up continuous deployment from within Azure gives you limited scope and I got constant errors which were not straightforward to fix. 但是,发现从Azure中设置持续部署会给您带来有限的范围,并且我得到的常量错误并非直接修复。

I ended up getting it working properly by following these instructions: 我按照以下说明最终使其正常工作:

Configuring it all from within VSO gives you a lot more clarity about what's actually happening. 从VSO中对其进行全部配置可以让您更清楚地了解实际发生的情况。

When doing the initial setup, I had to go through an authentication step with the Azure account I was trying to deploy to and that process launches a pop-up window which was getting blocked so I missed it at first. 在进行初始设置时,我不得不使用我尝试部署到的Azure帐户进行身份验证步骤,并且该进程启动了一个弹出窗口,该窗口被阻止,所以我一开始就错过了它。

The initial build and deploy were fine but I was getting a build error when being triggered from a code commmit. 初始构建和部署很好但是从代码提交触发时我遇到了构建错误。 This is because the Build Definition --> Variables --> BuildConfiguration value was set back to Release even though I set it to the correct value for my project when doing the initial configuration. 这是因为Build Definition - > Variables - > BuildConfiguration值已设置回Release即使我在进行初始配置时将其设置为项目的正确值。 Once I updated that, the next commit triggered the build which in turn created the artifact which in turn triggered the deploy which went through fine. 一旦我更新了它,下一个提交就会触发构建,而构建又会创建工件,而工件又会触发部署,而这个部署经历了很好的处理。

Googler from the future here, I had the same problem and came across a really good article called "DevOps: Connecting VSTS to Azure by Ken Muse" enter link description here 来自未来的Googler,我遇到了同样的问题并且遇到了一篇非常好的文章,名为“DevOps:通过Ken Muse将VSTS连接到Azure” 在这里输入链接描述

This worked like a charm for me from the first try! 从第一次尝试开始,这对我来说就像是一种魅力!

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

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