VSO / VSTS:Azure Powershell - 指定的凭据不能与身份验证方案“基本”一起使用

时间:2015-12-22 14:04:23

标签: azure tfs azure-web-sites msdeploy azure-devops

我有以下构建步骤,它在Azure Powershell中运行脚本。该脚本基本上将文件发布到Web应用程序(有关详细信息,请参见下文)。

Azure Powershell

这适用于我的所有网络应用程序,除了一个。我收到以下错误:

  

scriptCommand =& “C:\ A \ 8b0700333 \的Myproj \脚本\ Publish.ps1”   -websiteName mywebapp -packOutput“C:\ a \ 8b0700333 \ MyProj \ Api”
  停止网页应用...
  发布网络应用程序...
  使用发布方法[MSDeploy]发布   [错误]错误:指定的凭据不能与。一起使用   认证方案'基本'。
  [错误]错误:默认凭据   无法提供基本身份验证方案   [错误]参数名称:authType
  [错误]错误计数:1。

Publish.ps1脚本:

param($websiteName, $packOutput)

$website = Get-AzureWebsite -Name $websiteName

# get the scm url to use with MSDeploy.  By default this will be the second in the array
$msdeployurl = $website.EnabledHostNames[1]

$publishProperties = @{'WebPublishMethod'='MSDeploy';
                        'MSDeployServiceUrl'=$msdeployurl;
                        'DeployIisAppPath'=$website.Name;
                        'Username'=$website.PublishingUsername;
                        'Password'=$website.PublishingPassword
                        'SkipExtraFilesOnServer'='False'}

Write-Output "Stopping web app..."
Stop-AzureWebsite -Name $websiteName

Write-Output "Publishing web app..."
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"

. $publishScript -publishProperties $publishProperties  -packOutput $packOutput

Write-Output "Starting web app..."
Start-AzureWebsite -Name $websiteName

2 个答案:

答案 0 :(得分:3)

出现同样的问题,问题出在这样一个事实上,显然微软提供的脚本并不支持插槽。 在这里制作了固定版本https://gist.github.com/baywet/f7ed425c48ccde4399c7

帮助自己完成这篇文章How can I get the PublishUrl via Azure PowerShell?

答案 1 :(得分:1)

使用MS部署HTTP基本身份验证时,如果未指定任何凭据,通常会发生此错误。因此,您可以在PowerShell脚本中添加以下代码,以检查Web应用程序的发布用户名和密码是否正确。

Write-Output $website.PublishingUsername
Write-Output $website.PublishingPassword

另外,检查msdeployurl的值以查看它是否是正确的URL(通常如:youwebappname.scm.azurewebsites.net)进行部署。

Write-Output $msdeployurl