1

I have the following build step which runs a script in Azure Powershell. The script basically publishes files to the web app (see further down for details).

Azure Powershell

This works just fine with all of my web apps EXCEPT FOR ONE. I get the following error:

scriptCommand= & "C:\a\8b0700333\MyProj\Scripts\Publish.ps1" -websiteName mywebapp -packOutput "C:\a\8b0700333\MyProj\Api"
Stopping web app...
Publishing web app...
Publishing with publish method [MSDeploy]
[error]Error: The specified credentials cannot be used with the authentication scheme 'Basic'.
[error]Error: Default credentials cannot be supplied for the Basic authentication scheme.
[error]Parameter name: authType
[error]Error count: 1.

The Publish.ps1 script:

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
1

2 Answers 2

3

Had the same issue, the problem was coming from the fact that apparently the script Microsoft provides doesn't support slots. Made a fixed version here https://gist.github.com/baywet/f7ed425c48ccde4399c7

Helping myself from this post How can I get the PublishUrl via Azure PowerShell?

Sign up to request clarification or add additional context in comments.

1 Comment

Submitted a PR to what I believe is the source of the documentation, hopefully they'll update it github.com/chrisrpatterson/TeamBuildAspNet5Sample/pull/4
1

This error usually occurs when using MS deploy HTTP Basic Authentication without any credentials specified. So you can add following code in the PowerShell script to check if the publish username and password for the web app is get correctly.

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

And also, check the value of msdeployurl to see if it is the correct URL (Usually like: youwebappname.scm.azurewebsites.net) for deployment.

Write-Output $msdeployurl

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.