0

I downloaded the Publishing Profile from my App Service and created a profile on my WebApi.

When I execute "publishing" using VS 2017, it works fine. When I try to execute deploy command on Jenkins if fails. The error message I have is :

  • Deployment task failed. (Connected to the remote computer ("XXXXXXXX") using the Web Management Service, but could not authorize.
  • Make sure the site name, user name, and password are correct. If the issue is not resolved, please contact your local or server administrator.
  • Connected to the remote computer ("xxxxxxxxxxx") using the Web Management Service, but could not authorize.
  • The remote server returned an error: (401) Unauthorized.

I have a step on Jenkins using PowerShell command line like :

msbuild My.WebApi /P:AllowUntrustedCertificate=true /P:DeployOnBuild=True /p:PublishProfile=$myPublishProfile
  1. It builds without errors
  2. $myPublishProfile is a valid Path
  3. This Jenkins instance runs on a Server, not on my machine.
  4. Jenkins has its own SMC user and server auth user.
  5. App Service has WEBSITE_WEBDEPLOY_USE_SCM set to False
  6. I am using the same Publishing Profile to build on Jenkins and on Visual Studio.

If both are using the same Publishing Profile, why I am getting the Auth error ?

Is there is any other config I should do to perform Deploy from Jenkins ?

Gabriel Scavassa
  • 576
  • 1
  • 4
  • 21

1 Answers1

1

When you publish using visualstudio the password is stored in an encrypted file on your disk. If you need to publish with the msbuild-command you can add credentials on the commandline or in the publishprofile

append theese properties on the commandline:

msbuild ... /p:UserName=XXX /p:PassWord=YYY

or include in the profile

<UserName>XXX</UserName>
<Password>YYY</Password>
D.J.
  • 3,644
  • 2
  • 15
  • 22