Setting up continuous deployment for a Web app on Azure with a Visual Studio Online build

 

In this post I’ll create a continuous integration build with Visual Studio Online that deploys a Web App on an Azure Website.

Inside your VSO project click on the Build menu.

Click on plus sign and choose Visual Studio.

step1

 

Here we’ll configure our build to  produce and save the Web Deploy Package package file inside the staging directory.  This package will be used to deploy our Web App inside an Azure WebSite.

Copy paste the  following MSBuild arguments into the MSBuild Arguments:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=”$(build.stagingDirectory)”

step2

Now we’ll add a “Azure Web App Deployment” step.  Click “Add, build step” and choose in the category “Deploy” => “Azure Web Site Deployment”, click “Add”

step3

If you don’t have a Subscription configured click on: manage

step4

Click on: Configure service endpoint

step5

Choose certificate and click on publishsettings xml file

step55

Once your settings downloaded, open the file with notepad and copy the: Subscription id, Subscription name and certificate.

step6

Click OK.

Go back to the Azure build and click on refresh.

step7

Provide the “Web App Name” of your Azure Web App.

Choose your region.

Under “Web Deploy Package” you need to provide the path of your Web Deploy Package .This relates to the package location provided as an MSBuild argument in your build step (see here above).  As we published the package under the staging directory and because the package is a zip file, the following search path will do the work:
$(build.stagingDirectory)\**\*.zip

step8

Click on Save and provide a name for your new build.

You can now test your build by right-clicking on it and choose “queue build”.

step9

step10

If you want your build to become a continuous deployment build (runs at every check-in or after some time after the check-in): Edit you build definition and look for Triggers:

step11

 

 

 

 

 

 

 

 

 

 

 

 

Leave a Reply