Part 3: Deploy your custom code


In the first part of this series, we provisioned a brand new out-of-the-box Sitecore 9 on Azure PAAS with the help of ARM templates.

In the second part we created a blue-green deployment environment in order to have a clean deploy with each build but keeping the databases intact.

In this third installment of the Sitecore 9 in Azure Paas series we are going to deploy our custom code onto our PAAS solution.


Publish Profiles

Deployment of custom code is actualy quiet easy. There are different options to consider related to the fact if you are deploying directly from visual studio or the continuous integration software you are using.

  • Direct deployment from Visual Studio
    • Direct publishing with Web Deploy
    • FTP Deployment
  • Deployment from a continous integration platform
    • Create Web Deploy Package to deploy with msbuild
    • Publish to File System (and repackage on build server to deploy)


In a professional environment where you work with a team and have code collaboration, direct deployment from Visual Studio isn’t very interresting.

Though, for local deployment to your local instance of the solution deployment from Visual Studio is great and the most obvious option here is to go with the “File System” option for deployment.

In this article, however, we will keep the focus on deploying through a continuous integration software.

Web Deploy Packages

In order to achieve our goal, the first option is to use web deploy packages.

This method basicly creates a zip-file and some deployment cmd-files to deploy that zip-file onto a webserver.

You can then just execute the CMD file and pass some parameters.

  • /M:[machinename]
  • /U:[username]
  • /P:[password]
  • /A:[AuthType]
  • “-setParam:name=’IIS Web Application Name’,value='[SiteName]'”

You also want to add the DoNotDeleteRule to keep the files from sitecore already deployed in place.

  • “-enableRule:DoNotDeleteRule”


For Azure Paas AuthType should be set to “Basic”.

The other variabeles can be downloaded from Azure Portal.

Browse to your App Service and download the publish profile. You don’t have to import the profile into your project, but you can open it with notepad to obtain the credentials for deployment to your paas solution.

This method should work with any continous integration platform but requires the installation of msdeploy on the build server.


Visual Studio Team Services

If you use visual studio team services, there is an alternative option. (The advantages of staying within one eco-system :-))


VSTS comes with an inbuild integration to Azure.

The most important tasks here is the “Azure App Service Deploy”.

With this task, you can just select the subscription and app to deploy to from a dropdown list. (The first time you do this, vsts will create a special user in your azure subscription for deployment)

Next there are 2 options:

  • You deploy Web Deploy Packages by letting the system scan for zip files (as in screenshot)
  • You deploy to the filesystem of your build server and the select this folder where you deployed to. VSTS will handle the rest ootb.

This tasks also has build in support to deploy to slots.


What’s Next

As you could read, deployment isn’t that hard and there are different options to consider depending on the ecosystem you are leveraging.

Over the next blogposts in this series we will discuss these subject:

2 thoughts on “Part 3: Deploy your custom code

  1. David says:

    How did you generate the Web deployment Package with the custom code?

  2. bart.verdonck says:

    On your publish profile, on your project(s) in visual studio. You can choose the option “Web Deploy Package”. When you build the project it will create the web deploy package in the folder you specified on your publish profile.
    To build from continuous integration platform, you can run MSBuild to build your solution and pass these parameters: /t:build /p:PublishProfile= /p:Configuration=Release /p:DeployOnBuild=true


Leave a Reply

Your email address will not be published. Required fields are marked *