David Peterson bio photo

David Peterson

David is a Sitecore Architect with ATP World Tour, founder of the Philadelphia Sitecore Users Group and Technical Sitecore MVP. Often reminiscing of his days as a Sysop and being Elite.

Email Twitter LinkedIn Github

We all know the Sitecore Azure module for deploying Sitecore instances to the cloud. At the time of this post, Azure module support for Sitecore 8 has yet to be released. For those of us who want to move to a PaaS offering with Sitecore 8, we’re left searching for alternative methods of deployment.

This post covers the two other recommended approaches of deploying Sitecore 8 to Azure. Deployment through Visual Studio or Microsoft Azure PowerShell.

Option 1: Visual Studio

Deployments to Azure from Visual Studio can be executed both manually and through an automated process. Following steps to configure your solution, you must first convert your web project to a Microsoft Azure Cloud Service Project.

Required Tools

Diagnostics

Noting the differences between the Azure SDK versions, both diagnostic and caching has changed since 2.4.1:

  • New diagnostic configuration file (diagnostics.wadcfgx) introduced in 2.5.
  • Configuration via code has been removed.

Azure Package Creation

Upon converting your web project to a Cloud Service project, publishing the cloud service project generates your .cspkg file in the bin of your Cloud Service project and publishes to Azure with credentials entered when prompted at the start of the publishing process.

In preparation for deployment, any files included in your web project must exist, as missing references to any files will prevent your deployments from succeeding. Visual studio will fail the build and mark the missing references as errors.

azure package creation

Output of the build will resemble:

azure package output

Deployment Experience

The benefits of this approach allow for publishing to Azure directly from Visual Studio, which is fine if you’re a developer and already familiar with the IDE. If you’re not as tech-savvy, this process can be automated through command-line deploys using MSBuild or through Azure PowerShell (more on this later).

Solution Configuration

In order to deploy from Visual Studio, all necessary files to run Sitecore under a cloud service will need to be included in your solution, otherwise, they will not be deployed. Such a configuration is helpful in that you can see all files necessary for deployment, but quickly can clutter-up your solution and projects. Not to mention performance implications of including all the necessary folders and files required for either a CE or CD instance.

This may just be a personal preference of mine, but I like to keep my project file and folder inclusions to a minimum. Including only those files needed for my local development instance, while copying and merging in dependencies through build scripts specific to each deployment target.

Conclusion

Go with this approach if you’re testing a local sandbox environment and do not have a solid automated build and deployment process in place.

Option 2: Azure PowerShell

Much like the approach with Visual Studio, deployment to Azure is a two step process – create the package then deploy it to Azure. You can generate the .cspkg file directly by calling cspack.exe from the command line. Azure PowerShell will take care of the deployment.

Prior to deploying via PoweShell, you must first install Microsoft Azure PowerShell on the server you wish to deploy from. The Microsoft Azure PowerShell cmdlets allow for obtaining and pushing assets to the cloud. Following a similar approach for configuring continuous delivery of a Cloud Service to Azure, we can write a PowerShell script to deliver Sitecore 8 to Azure using PowerShell cmdlets.

Common cmdlets used in deploying Sitecore 8 to Azure:

Required Tools:

Deployment Authentication Options

For automated deployments, you must also automate authentication in order to push your build to either a new or existing cloud service. There are two options: use a Publish Settings file or through a management certificate.

1. Publish Settings File

The first, publish settings file, contains your Azure subscription information . You can use this file to set the active subscription through Import-AzurePublishSettingsFile followed by Get-AzureSubscription. While this is a useful approach, note that your publish settings file allows full access to all features available by your subscription.

publish settings file

2. Management Certificate

Another option is to use a Service Certificate for Azure. Generate a certificate local to the machine where you will be deploying. You can do this either from the command line or directly in the MMC Certificate Snap-in. Thanks to Kam Figy on discovering this approach.

If using the MMC Snap-in, export the certificate to a .cer file by clicking on “Copy to File…”.

certificate

Upload the certificate file to your subscription in Azure. Notice the Thumbprint will then be listed along with your certificate name.

azure portal

You can then use the certificate thumbprint as a parameter for Set-AzureSubscription, eliminating the need for obtaining and importing the publish settings file.

Note that calling Get-AzurePublishSettingsFile also generates a certificate. That certificate has a default expiration of 24 hours.

Example

The following is Azure PowerShell cmdlets output for deploying Sitecore 8 to a new Cloud Service:

azure portal

While the script is running, you will periodically receive updates on progress, such as uploading:

azure portal

and deployment of the new cloud service:

azure portal

Conclusion

Go with Azure PoweShell for any continuous delivery solutions or automated deployments through build scripts.