5

What we do today

Currently, we Web Deploy to Windows Azure Web Sites (WAWS) via MSBuild for our test environment using the following command

MSBuild.exe /p:Configuration=Test /p:DeployOnBuild=true /p:PublishProfile=Test 
            /p:AllowUntrustedCertificate=true /p:UserName=AzureDeploymentUser 
            /p:Password=AzureDeploymentPassword Solution.sln

What I want to accomplish

I want to create a prod build / deployment at the same time as our test build (not in the same call to MSBuild, unless its possible), and later, at some time that the build passes testing, deploy the prod build to prod via the command line. (preferably with Web Deploy)

How I think I can accomplish this

I suspect that the best way to do this is to create a Web Deploy Package at Test build time. And then later, deploy that Web Deploy Package.

What I need to know

  1. Is a Web Deploy Package / subsequent deployment of that package, the best way to do this?
  2. How do you deploy a web deploy package from the command line? Right now its painfully easy to deploy via MSBuild with the right parameter set, I'd like to keep it that simple.

I already know how to create a Web Deploy Package that creates the following files

ProjectName.zip
ProjectName.deploy-readme.txt
ProjectName.deploy.cmd
ProjectName.SetParameters.xml
ProjectName.SourceManifest.xml

I just don't know how to deploy that package to Windows Azure Web Sites

Allen Rice
  • 19,068
  • 14
  • 83
  • 115
  • 1
    Have you seen PackageWeb http://sedodream.com/2011/12/24/PackageOncePublishAnywhere.aspx? I think it will help you simplify this. – Sayed Ibrahim Hashimi Mar 25 '15 at 03:16
  • @SayedIbrahimHashimi, the code/process does not appear to work as of Mar-2016. Is there potential for an update? – Snowy Mar 24 '16 at 17:29
  • @Snowy if you are having a problem please file an issue at https://github.com/sayedihashimi/package-web/issues – Sayed Ibrahim Hashimi Mar 26 '16 at 17:07
  • @allen - Did you find solution for it? – Yogi May 27 '16 at 06:31
  • @Yogi yep, we call the x.deploy.cmd with the azure deployment credentials and that will properly deploy it to the azure website – Allen Rice May 31 '16 at 19:31
  • @AllenRice thanks for posting this. We have similar issue but this answer didn't work. Please have a look https://stackoverflow.com/questions/50799830/make-msdeploy-exe-deploy-a-msbuild-generated-zip-package-to-azure – Artyom Jun 11 '18 at 14:14

2 Answers2

2

Have you checked the web app deploy page? Azure commandlets in powershell are popular.

Greg D
  • 43,259
  • 14
  • 84
  • 117
  • I've been digging around in the web deploy package and looking at the cmd file that it generates. I think I can use this in conjunction with the deployment settings that you can download from azure. I'll try it and post the results if it works – Allen Rice Mar 24 '15 at 20:08
2

We ended up using this batch file to deploy the package to azure. I named the variables the same as the variables you get when you download the azure deployment credentials from the azure control panel.

SET cmdPath=MSBuildGeneratedDeploymentPackage/yoursitename.deploy.cmd
SET publishUrl=yoursitename.scm.azurewebsites.net:443
SET userName=$yoursitename
SET userPWD=passwordFromAzureDeploymentCredential

%cmdPath% /y "/m:https://%publishUrl%/MsDeploy.axd" -allowUntrusted /u:"%userName%" /p:"%userPWD%" /a:Basic
Allen Rice
  • 19,068
  • 14
  • 83
  • 115