In this blog series I am going to use Microsoft Azure, Visual Studio Team Services, and Sitecore 8.2 to show you how to automate your entire build, test, and deploy pipeline. This is going to be a step by step guide starting with a blank Azure subscription. I will be providing high level and low level architecture diagrams, PowerShell examples, and ARM templates throughout the series.

We will explore the immutable infrastructure pattern, blue/green deployments and on-the-fly provisioning of environments based off of branches. Our goal will be to leverage as much of the Azure/Microsoft stack as we can and write as little code (except for PowerShell).

The Model Architecture

Below is the architecture we will be building. The architecture is divided into 4 major sections:

  • Feature Environments
  • Test Environments
  • Blue / Green Environments
  • Management Resources

The environments are modeled after the GitFlow branching strategy. Ideally we will be able to spin up a semi isolated environment on the fly to test our code.

Feature Environments

Feature environments are short lived combined CM/CD instances. They are used to test individual features and their URL and configuration is based on the branch name. The configuration variances will be based on a convention using the branch name. An example of this would be the URL. An example URL for a feature branch named "Foo" would be, our SQL databases would be named with the convention: Foo-Feature-Sitecore-Master etc.

Test Environments

Test environments will have the CM and CD roles separated out onto role specific machines. These environments will be scaled down versions of production. One of these environments will serve as CI and be driven by our development branch. Another environment will be used as a sandbox with manual deployments. This will be used for testing bug fixes and offer a stable pre-production test environment.

Blue / Green Environments

Our Blue Green Environments will be exact mirrors of each other. Either of the two can be put into live production after testing. UAT testing will occur on these environments. Once a release has been tagged it will be deployed to the whichever of the two is not currently in production. This will allow us to do load testing, stage content, and reduce the amount of testing required.

Management Resources

Management Resources will include our Azure OMS resource, Storage accounts with reusable ARM templates, base Sitecore installs, and database backups. Visual Studio Team Services will also fall under the category of Management Resources.

Tools: PowerShell

Throughout this series we will be using a significant amount of PowerShell to automate anything we can. The two main areas PowerShell will be used are for bootstrapping our VMs (installing Roles/Features, configuring Windows Firewall etc.) and the AzureRM PowerShell API. The AzureRM PowerShell API will be used to provision and configure resources, as well as aid in our release processes.

Tools: ARM Templates

Azure Resource Manager Templates (ARM) will be used to represent our infrastructure. These JSON templates will be stored in version control and used during our build / deployments to provision the appropriate infrastructure for testing. When infrastructure changes are required, they will be made in these templates. This will ensure that our environment configuration is under version control and easily reproducable.

Tools: Azure OMS

Azure Operational Management Suite will be used to perform routine management tasks such as operating system updates, log management, network analytics, alerts and more.

Tools: Visual Studio Team Services

Visual Studio Team Services will be used to manage our source code and orchestrate builds and deployments.

General Considerations and Approach

I have tested a large portion of what I am about to present on live projects, however where possible, I will be trying to use new Azure services and Azure features that may not have official support from Sitecore yet. Where possible, I will always choose PaaS offerings over IaaS, examples of this would be Azure SQL, or DocumentDB for Mongo. I hope you enjoy this series as much as I enjoyed putting it together, and please feel free to reach out to me on the Sitecore Slack channel with any questions.