VSTS 发布定义问题

Issue with VSTS Release Definition

我有一个 ASP.NET MVC 应用程序并想将其部署到 Azure 云服务。

我已添加 Azure 云服务部署任务并尝试使用 "New button" 配置订阅详细信息。有两个字段要求输入用户名和密码。所以我输入了我用来登录 portal.azure.com 的凭据。但是我在发布过程中遇到错误。如果我遗漏了什么,你能帮忙吗?

2018-02-14T22:43:28.0976940Z ##[command]Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\AzureRM.Profile.1.0\AzureRM.Profile.psm1 -Global
2018-02-14T22:43:28.1499971Z ##[command]Add-AzureAccount -Credential System.Management.Automation.PSCredential
2018-02-14T22:43:31.8827701Z ##[error]AADSTS50079: The user is required to use multi-factor authentication.

您可以创建一组不同于您的 Microsoft 帐户凭据的部署凭据

一切都解释得很好here

When you log into Microsoft Azure you are logging in with a Microsoft Account. This account lets you add, modify, and remove resources within your Azure subscription. Some Azure resources such as Websites and Mobile Services require a separate deployment credential to publish code. This separate deployment credential can be confusing and I wanted to document a few key points:

  1. The username you choose for the deployment credential must be unique across all Azure subscribers.
  2. The deployment credential you create is tied to your Microsoft account and is the same credential for all Azure resources which require a deployment credential.
  3. You do not want to share your deployment credential. Again, this credential has access to publish code to all Websites and Mobile Services that your Microsoft account can administer

Azure 经典门户已停用,因此您需要使用新门户并添加 Azure 资源管理器 (Azure RM) 服务端点。

添加 Azure RM 服务终结点的简单方法:

  1. 创建新的构建定义
  2. 添加 Azure 应用服务部署任务,select可用 Azure 订阅中的项目
  3. 点击授权按钮

之后,它会将相关的服务端点添加到您的团队项目中。

另一种方法是,您可以参考这篇博客添加服务端点:

Connect your Azure subscriptions to VSTS in 3 clicks