How to deploy to Azure Web Site from command line RRS feed

  • Question

  • Hi.

    I tried from VS it works fine, publish functionality works. But once I try to run it from cmd I'm unable to deploy.

    I'm building web project with target=Package and getting folder with zip and cmd file.

    Than i run

    C:\repos\vc\DeployPackage>VC.deploy.cmd /y "/m:https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd" /u:sitename\login /p:password

    I was unable to deploy it getting this error:

    More Information: Connected to 'waws-prod-blu-001.publish.azurewebsites.windows.
    net' using the Web Deployment Agent Service, but could not authorize. Make sure
    you are an administrator on 'waws-prod-blu-001.publish.azurewebsites.windows.net
    '.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_
    Error: The remote server returned an error: (401) Unauthorized.
    Error count: 1.

    Could you please help how to deploy the package from command line? Thank you.

    Saturday, June 9, 2012 5:06 PM


All replies

  • Hi,

     I am checking with the Web Deploy team and will come back to you soon.

    Thanks for trying Windows Azure Web Sites!

    Nir (Azure team)

    WER Services Program Manager

    Sunday, June 10, 2012 2:49 AM
  • Hey,

     Checked with the team and you have to add the site name as a query string parameter for the WebDeploy end-point. It would be:

    C:\repos\vc\DeployPackage>VC.deploy.cmd /y "/m:https://waws-prod-blu-001.publish.azurewebsites.windows.net/msdeploy.axd?site=<sitename>" /u:sitename\login /p:password

    WER Services Program Manager

    Sunday, June 10, 2012 3:29 AM
  • Not working for me

    ....deploy.cmd /y "/M:https://waws-prod-am2-001.publish.azurewebsites.windows.net/msdeploy.axd?site=<mysite>" /U:<sitename>\<login>  /P:<pass>

    still Error Code: ERROR_USER_NOT_ADMIN

    I use data from PublishSettings file

    • Edited by Rasp_Z Tuesday, August 14, 2012 1:47 PM
    Tuesday, August 14, 2012 1:47 PM
  • Are you sure you're using the correct username and password from your publish profile? If so, please give me your site name and I'll see what I can find out.


    Jim Cheshire | Microsoft

    Tuesday, August 14, 2012 5:31 PM
  • I hope so. I spend many hours with this.

    site = testcml

    Wednesday, August 15, 2012 8:03 AM
  • Can you please make sure? Your Web Deploy credentials will typically be a dollar sign followed by your site name. If you don't use the correct credentials, you can enounter this error.

    Jim Cheshire | Microsoft

    Thursday, August 16, 2012 2:47 PM
  • Yes Im sure.

    Deploy from VS2012 works great. Thats the mystery.

    Thursday, August 16, 2012 7:07 PM
  • Okay. Can you please tell me the date and approximate time that this happened to you so that I can query our data and locate the failure?


    Jim Cheshire | Microsoft

    Thursday, August 16, 2012 7:14 PM
  • Right now
    Monday, August 20, 2012 8:31 AM
  • I checked publish errors from 2:00 until 4:30 (my local time, but covers the time you posted) and I don't see any publish errors for your site.

    Probably the best thing for you to do would be to open a support ticket with us. We can then engage the operations guys to look into this for you.

    Jim Cheshire | Microsoft

    Monday, August 20, 2012 12:57 PM
  • you need to add /a:basic to force webdeploy using basic authentication.



    Tuesday, August 21, 2012 1:44 AM
  • Thanks, but I still have the same error. Any other ideas? :(

    Wednesday, August 22, 2012 10:13 AM
  • Ok, problem solved:)

    /u:sitename\login means sitename or login not sitename + back slash + login

    Wednesday, August 22, 2012 11:19 AM
  • Thanks for the update. Yes, you need to ensure you use the Web Deploy credentials from the publish profile. For Web Deploy, the username will be a dollar sign followed by your sitename. The credentials that use a slash and sitename + username are typically deployment credentials for FTP, etc. Sorry for the confusion.

    Jim Cheshire | Microsoft

    • Proposed as answer by bgx08 Wednesday, October 24, 2012 12:10 PM
    • Unproposed as answer by bgx08 Wednesday, October 24, 2012 12:10 PM
    Wednesday, August 22, 2012 3:40 PM
  • I had consistent authorization errors trying to deploy from the command line as suggested above.

    The issue was that I had used mysite.azurewebsites.net  instead of just mysite in the “Site/application” field at the “Connection” step when setting up the Publishing profile to create the package.

    This resulted in mysite.azurewebsites.net  being inserted into the SetParameters.xml file as value for "IIS Web Application Name", which caused the problem. Apparently this should only be mysite.

    The full command line syntax that worked for me then is:

    {PackageName}.Web.deploy /t "/m:{Publish Url from credentials}/msdeploy.axd?site=mysite" /u:$mysite /p:{Password from credentials} /a:basic 

    (Note the quotes around the /m parameter!)


    Wednesday, October 24, 2012 12:14 PM
  • I just tried to deploy a website to a new set-up on the East Asian datacentre and got ERROR_CERTIFICATE_VALIDATION_FAILED

    Apparently there is a problem with the certificate on the remote end.

    It is possible to deploy using the -allowUntrusted flag, but I hope the certificate issues get resolved.

    Further info: http://www.iis.net/learn/publish/troubleshooting-web-deploy/web-deploy-error-codes


    • Edited by bgx08 Thursday, November 22, 2012 10:32 AM
    Thursday, November 22, 2012 10:31 AM