Sitecore Azure ARM Deployment

Sitecore 8.2.1 on Azure PaaS Web Apps part 2: ARM Templates

As I already mentioned in the first part of the tutorial there are two ways to deploy Sitecore 8.2.1 to Azure Web Apps. In this post, I am going to talk about the second option which is installation using Azure Resource Manager Templates.

Sitecore 8.2.1 ARM Deployment step by step:

  1. Install the latest version of Azure PowerShell SDK.
  2. Run PowerShell console and execute the above lines:
    Set-ExecutionPolicy AllSigned
    # Install the Azure Resource Manager modules from the PowerShell Gallery
    Install-Module AzureRM
    # Install the Azure Service Management module from the PowerShell Gallery
    Install-Module Azure

    I experienced an issue: “some modules were not signed by a trusted provider” while setting the Execution Policy to AllSigned. To bypass the issue run:

    Set-ExecutionPolicy RemoteSigned
  3. Define the architecture of your solution to be aware which WebDeploy packages version you should use:
    • XP0 – Single web application instance. Usually used for development environments.
    • XP/XP1 – Contain four dedicated roles: Content Management (CM), Content Delivery (CD), Processing and Reporting. This type of configuration allows to use xDB and usually is in use on production environments.
    • XM/XM1 – Separate instances of CM and CM. Works in CMS-only mode (without xDB).
  4. Depending on your architectural choice in step 3 – Download necessary web deploy packages from the Sitecore Vanilla distribution which are you going to use, in our case 8.2.1: https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/82/Sitecore_Experience_Platform_82_Update2.aspx
    The web deploy comes in a zip file but that is not the zip file you upload to the storage account, you need to extract it and upload the .zip files there. Depending on the type of environment you will be deploying, you will see a different number of zip files which represents the web roles or instances.
  5. Set up Azure storage account and upload your Sitecore Web Deploy packages to blob storage location. The Blob service contains the following components:
    • Storage Account – All access to Azure Storage is done through a storage account. This storage account can be a general-purpose storage account or a Blob storage account which is specialised for storing objects/blobs.
    • Container – A container provides a grouping of a set of blobs. All blobs must be in a container. An account can contain an unlimited number of containers. A container can store an unlimited number of blobs. Please, note that the container name must be lowercase.
    • Blob – A file of any type and size. Azure Storage offers three types of blobs: block blobs, page blobs, and append blobs.
  6. Ensure you have a cloud-hosted instance of MongoDB for Experience Database in XP and XP0 configurations. You can use mlab.com subscription to create a free MongoDB databases: sitecore_analytics, sitecore_tracking_contact, sitecore_tracking_history, sitecore_tracking_live. Copy the MongoDB URLs with username/password eg:
    mongodb://[youraccountusername]:[youraccountpassword]@ds054479.mlab.com:54479/sitecore_analytics

    .
    Please, note that for each database it will open a different port so use this link just for reference.

  7. Clone GitHub Sitecore Azure Quickstart Templates repository. Find a folder corresponding to your solution architecture and amend the parameters inside the azuredeploy.parameters.json file.
    {
    "deploymentId": {
    "value": "" // title of your deployement - no spaces
    },
    "sitecore.admin.password": {
    "value": "" // create a password for sitecore admin password. Must be 8+ characters, containing at least one capital letter and 1 number
    },
    "analytics.mongodb.connectionstring": {
    "value": "" // MongoDB connection string that you copied earlier
    },
    "tracking.live.mongodb.connectionstring": {
    "value": "" // MongoDB connection string that you copied earlier
    },
    "tracking.history.mongodb.connectionstring": {
    "value": "" // MongoDB connection string that you copied earlier
    },
    "tracking.contact.mongodb.connectionstring": {
    "value": "" // MongoDB connection string that you copied earlier
    },
    "sqlserver.login": {
    "value": "" // Create a login for SqlServer
    },
    "sqlserver.password": {
    "value": "" // Create a password for SqlServer. Must be 8+ characters, containing at least one capital letter and 1 number
    },
    "single.msdeploy.packageurl": {
    "value": "" // URL of the sitecore package you added in your Azure blob
    },
    "licenseXml": {
    "value": "" // URL of the sitecore license.xml file (can be at the same level as this file when running the powershell)
    }
    }
    
  8. Go again to https://github.com/Sitecore/Sitecore-Azure-Quickstart-Templates and copy the provided sample PowerShell Script. Save it as deployment.ps1 and update parameters:
    $ArmTemplatePath = ".\azuredeploy.json"; // URL of your azuredeploy.json file
    $ArmParametersPath = ".\azuredeploy.parameters.json"; // URL of your azuredeploy.parameters.json file
    $licenseFileContent // Location of your license.xml file
    $Name = "RESOURCE_GROUP_NAME"; // It must be the same name as deploymentId in azuredeploy.parameters.json file
    $location = "AZURE_DATA_CENTER_NAME"; // Location of your Azure data center
    $AzureSubscriptionId = "AZURE_SUBSCRIPTION_ID"; // Your Azure subscription ID. It can be found in https://portal.azure.com/#blade/Microsoft_Azure_Billing/SubscriptionsBlade
  9. Ensure that these files are in the same directory and all the mandatory lines are changed:
    • license.xml – Sitecore license
    • azuredeploy.json
    • azuredeploy.parameters.json
    • deployment.ps1 – sample PowerShell Script
  10. Time for the deployment! Go to command line and run the deployment.ps1 script. The deployment can take up to 45 minutes depending on the configuration which you have chosen. By the end of the deployment, you will see “Deployment complete” message. Then you will be able to see the resources in the Azure management portal. You can try to access your website and Sitecore back-end.

Congratulations, you just have deployed Sitecore vanilla! To easily deploy customised application you can use “Publish Profile”.

Deployment of customizations from Visual Studio using Publish Profile from Azure

  1. Go to Azure Management Portal, extend the left menu and click on App Services. You will see your new app.
  2. You can then right click on it and “Get publish profile”. It will download a file.
  3. Go to Visual Studio and right click on the Website Project > Publish > Select a publish target > Import. Choose the recently downloaded file. It should automatically populate the other tabs (connection, settings) for you.
  4. Click Publish and check if your changes are visible on your website.

Leave a Reply

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