Azure 部署任务在 Powershell 凭据设置上失败

Azure Deployment Task Fails on Powershell Credential setting

我有一个 Visual Studio 团队服务构建定义,用于将 Asp.Net MVC 应用程序部署到 Azure 网站。我使用向导创建我的构建定义,所以它是非常普通的实现。

大部分构建进展顺利。 'Get Source'、'Build Solution'、'Test Assemblies'任务全部通过。但是 'Azure Deployment' 的任务失败了,在我看来好像 PowerShell 凭据有问题。

错误统计:

AADSTS50034: To sign into this application the account must be added to the mydomain.org directory.

由于这是 运行 在云中,我不知道它试图使用哪个帐户,所以我正在寻找一些如何通过这一步的想法。

这是 Azure 部署任务的输出。

******************************************************************************
Starting task: Azure Deployment: http://superpoolsquares.azurewebsites.net
******************************************************************************
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\AzureWebPowerShellDeployment.0.23\Publish-AzureWebDeployment.ps1
Importing Azure Powershell module.
Importing AzureRM Powershell module.
AzurePSCmdletsVersion= 1.0.0
Get-ServiceEndpoint -Name edb1710a-25b3-4037-93b0-58c00f83c038 -Context Microsoft.TeamFoundation.DistributedTask.Agent.Worker.Common.TaskContext
Username= ********
azureSubscriptionId= b4d2fa61-92ff-494a-9ff1-d1362895fc78
azureSubscriptionName= Visual Studio Professional with MSDN
Add-AzureAccount -Credential $psCredential

AADSTS50034: To sign into this application the account must be added to the mydomain.org directory.

Trace ID: 2cb051b9-6e76-4789-8a5d-e95a9486b731

Correlation ID: 22162659-23fa-4858-b957-9ccbf120654d

Timestamp: 2016-02-10 00:19:27Z: The remote server returned an error: (400) Bad Request.
Add-AzureRMAccount -Credential $psCredential

AADSTS50034: To sign into this application the account must be added to the mydomain.org directory.

Trace ID: ed10284e-87b6-4d45-8bd3-9ed1b25f4498

Correlation ID: 88960dea-0434-4eba-9f17-e4d6ceba1a41

Timestamp: 2016-02-10 00:20:21Z: The remote server returned an error: (400) Bad Request.

There was an error with the Azure credentials used for deployment.

它使用您在“服务终结点”对话框中配置的帐户,如下所示: 根据错误消息,您使用的帐户未添加到 mydomain.org 目录,该目录是订阅的受信任 AD。因此,您需要从 Azure 门户将您的帐户添加到该目录,然后尝试部署。

如果您不想在 Azure 上进行任何更改。您可以在配置连接时使用 "Certificate Based" 身份验证。