问题描述
我有一个Visual Studio Team Services构建定义,可以将Asp.Net MVC应用程序部署到Azure网站.我使用向导创建了构建定义,因此它是非常原始的实现.
I have a Visual Studio Team Services Build Definition to deploy an Asp.Net MVC application to Azure Web Site. I used the wizards to create my build definition so it is pretty vanilla implementation.
大部分构建都进行得很好.获取源代码",构建解决方案",测试程序集"任务全部通过.但是"Azure部署"的任务失败了,在我看来,PowerShell凭据似乎有问题.
Most of the build goes well. The 'Get Source', 'Build Solution', 'Test Assemblies' tasks all pass. But the task for the 'Azure Deployment' is failing and it looks to me as though it is having problems with the PowerShell credentials.
错误统计信息:
AADSTS50034: To sign into this application the account must be added to the mydomain.org directory.
由于该帐户正在云中运行,因此我不知道该帐户尝试使用什么帐户,因此我正在寻找一些方法来解决这一问题.
Since this is running in the cloud, I don't know what account it is trying to use so I am looking for some ideas how to get past this step.
这是Azure部署任务的输出.
Here is the output of the Azure Deployment task.
******************************************************************************
Starting task: Azure Deployment: http://superpoolsquares.azurewebsites.net
******************************************************************************
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\AzureWebPowerShellDeployment\1.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 Portal添加到该目录中,然后尝试进行部署.
It uses the account you configured on Service Endpoints dialog as following:According to the error message, the account you use isn't been added to the mydomain.org directory which is the trusted AD by the subscription. So you need to add your account into that directory from Azure Portal and then try the deployment.
如果您不想在Azure上进行任何更改.配置连接时,可以使用基于证书"的身份验证.
If you don't want make any change on Azure. You can use "Certificate Based" authentication when configure the connection.
这篇关于Powershell凭据设置上的Azure部署任务失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!