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.
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.
- “-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.
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.
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: