April 02, 2019 | Kliment Klimentov
By using TDS 5.8 and Web Deploy packages, I'll walk you through on how to create a fully automated build and deployment process from your workstation to source control and into your Azure environment. This is a simplified scenario that describes a build process which can be used for a starting point. Depending on your organizational (or customer) needs and additional preferences, the build process could be more complex.
The TDS Web Deploy packages were designed around quick and easy deployments to Azure, but they can be deployed to any Sitecore server that supports Web Deploy.
The difference in using .update packages and Web Deploy packages
With TDS versions before 5.8, most build configurations used Update packages to deploy changes to Azure environments. This is still a good way of deploying code, but it comes with some downsides. To automate the process, we used the Sitecore Package Deployer tool which waits for a package in a certain location and installs it automatically once the package is present. Unfortunately, the Update package API didn't give us many details about the progress of the installation. We only received notifications of completion and success/failure. Determining the reason for failure requires downloading logs from the server.
Workflow before TDS 5.8
TDS 5.8 introduces a better approach for deploying Sitecore items and code in Azure environments. Using Web Deploy packages and a PowerShell script provided by TDS, we provide better information about the progress of the deployment into your Azure hosted Sitecore instance. The new deployment process in TDS 5.8 also includes huge performance benefits with faster deployments.
Workflow after TDS 5.8
Setting up the TDS project for Web Deploy
The Web Deploy Package tab has similar options to the Update package tab. You can enable building a Web Deploy package, what to include in the package, and the package name. In this example configuration, we'll need a Web Deploy package, so we'll check off "Build web deploy package." The name can be left blank, and it will use the name of the project.
Since we are planning to build on the cloud based VSO build server, we need to add the TDS Build components NuGet package into the TDS project. To do this, you need to execute the following command in the Package Manager Console of Visual Studio. Side note: make sure you have selected the nuget.org repository while executing this command.
Install-Package HedgehogDevelopment.TDS -Version 184.108.40.206
Building the Web Deploy package
To create the Web Deploy package, simply build the project/solution with the configuration where Web Deploy packages are enabled. When the build is finished, you will find a folder called [Configuration]_WebDeploy with the Web Deploy package and the Web Deploy PowerShell script.
Please note: the PowerShell script provided by TDS isn't the only way to install the package. It is provided as a convenience for the developer to help them deploy the package if they don't have another method of deploying it. It also contains script that can be used to monitor the deployment on the server.
Testing the Web Deploy package
Once you have the Web Deploy package and the PowerShell script, you only need to specify where it should be deployed. This can be easily set using a Publish Profile from Azure or by using parameters to the PublishWebDeploy.ps1 script. You can get a publish profile from the control menu of the App Service in Azure.
Now you can make a test deployment to the Sitecore instance using the script. I placed my Publish Profile file in the same directory where the Web Deploy package and the script were generated.
If you want to deploy the Web Deploy package into your Azure instance, all you need is to execute the script using the following parameters:
PublishWebDeploy.ps1 -PackagePath TDSProject1.wdp.zip -PublishSettingsPath tdstestinstance-630820-single.PublishSettings -ViewLogs
This completes the setup of the TDS project for building Web Deploy packages. Soon, I'll walk you through on how to set up a TDS build in a Visual Studio Online Build Pipeline.
Need to skip ahead to configuring Azure DevOp's Release Pipelines? Click here to read Part Three.