![](/img/trans.png)
[英]Double hopping credentials from VSTS through Azure PowerShell script to PowerShell script on target VM
[英]VSO/VSTS: Azure Powershell - The specified credentials cannot be used with the authentication scheme 'Basic'
我具有以下构建步骤,该步骤在Azure Powershell中运行脚本。 该脚本基本上将文件发布到Web应用程序(有关详细信息,请参阅下文)。
这对于我所有的Web应用程序都适用(除了一个)。 我收到以下错误:
scriptCommand =&“ C:\\ a \\ 8b0700333 \\ MyProj \\ Scripts \\ 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
遇到相同的问题,问题出在微软显然提供的脚本不支持插槽这一事实。 在这里制作了固定版本https://gist.github.com/baywet/f7ed425c48ccde4399c7
当使用MS部署HTTP基本身份验证而未指定任何凭据时,通常会发生此错误。 因此,您可以在PowerShell脚本中添加以下代码,以检查Web应用程序的发布用户名和密码是否正确。
Write-Output $website.PublishingUsername
Write-Output $website.PublishingPassword
另外,检查msdeployurl的值以查看它是否是用于部署的正确URL(通常为:youwebappname.scm.azurewebsites.net)。
Write-Output $msdeployurl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.