简体   繁体   中英

Deploy to Azure using publish profile : Works when publishing on VS2017 fails when using Jenkins

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 ?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM