Sitecore 10.1 Azure Toolkit

February 23, 2022

The following resources were used to create new Sitecore 10.1 resources in Azure using the Sitecore Azure Toolkit:

SOLR

You need a running SOLR instance to create a new Sitecore environment in Azure with the Azure Toolkit. I followed Ashish Sharma's article and documented my experience here:

Web Deploy Packages

Then I followed the Azure Toolkit instructions (linked above) to get the relevant WDP files and store them in an online accessible location. The CM and CD WDPs are found on the download page for Sitecore 10.1:

Sitecore 10.1 Downloads Page with WDP Packages

The Identity Server WDP is found on a separate download page for Sitecore Identity. I then downloaded and installed the Microsoft Azure Storage Explorer and connected the application to our Azure subscription. The CM, CD, and ID WDP files were uploaded to a new Blob Container at Storage Accounts/storage container name/Blob Containers/sitecore-WDPs.

After the files uploaded, I right clicked the storage container and chose Generate Shared Access Signature:

Sitecore 10.1 Downloads Page with WDP Packages

Once the signature is generated, I copied the Query string value and saved it. Then right-clicked each of the uploaded files, selected Copy Url, then saved them as well. Finally, I appended the query string value of the Shared Access Signature to each URL. These will be used in the azuredeploy.parameters.json file in the next step.

ARM Templates

Next, I downloaded the azuredeploy.parameters.json file for the Sitecore version I was installing:

I pasted the WDP URLs from the previous step into this file in the cmMsDeployPackageUrl, cdMsDeployPackageUrl, and siMsDeployPackageUrl parameters. I chose a deploymentId parameter that will be used as the prefix for all created app services. Next, I chose a location parameter that represents the region these app services will be created in. Then I chose a sqlServerLogin and sqlServerPassword for the administrative login to the SQL Server that will be created. Similarly, I selected a sitecoreAdminPassword for the administrative login to the Sitecore website. Finally, I added a new parameter string for SOLR like the following:

"solrConnectionString":{
    "value": "https://solr-app-service-name.azurewebsites.net/solr"
}
        

Certificates

Next, I created a new certificate by following the instructions in this document. Open PowerShell as an administrator and then run the following commands:

$thumbprint = (New-SelfSignedCertificate -Subject "CN=Sitecore 10 on Azure App Services" -Type SSLServerAuthentication -FriendlyName "Azure Sitecore 10 Certificate").Thumbprint

$certificateFilePath = "C:\temp\$thumbprint.pfx"

Export-PfxCertificate -cert cert:\LocalMachine\MY\$thumbprint -FilePath "$certificateFilePath" -Password (Read-Host -Prompt "Enter password that would protect the certificate" -AsSecureString)
        

After this 3rd command, it prompted me to enter a password for the certificate. I created a new password, added it to the azuredeploy.parameters.json file as the authCertificatePassword parameter, typed it into the console, and pressed enter. Finally I ran the following command:

[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($certificateFilePath))
        

I copied the output of this command into the azuredeploy.parameters.json file as the authCertificateBlob parameter. Then because I'm using a self-signed certificate and not one issued by a trusted authority, I needed to add the following parameter to the azuredeploy.parameters.json file:

"allowInvalidClientCertificates": {
    "value": true
}
        

Installing PowerShell v7, AZ PowerShell Module, and Az.Accounts

I then opened up Windows Powershell as an Administrator and made sure I was using at least PowerShell version 7 with the following command:

$PSVersionTable.PSVersion
        

After confirming, I entered the following commands:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force -AllowClobber
        

(Note: this command takes forever and doesn’t provide any visual feedback during the installation. Just be patient)

Import-Module Az.Accounts

Connect-AzAccount
        

Login to Azure and authorize the application. If you have more than 1 subscription, you can make sure it is selected with:

Get-AzSubscription -SubscriptionName "MySubscriptionName"|Select-AzSubscription
        

Installing Azure Toolkit and Setup Staging Directory

I proceeded to install Azure Toolkit and setup a directory to run the PowerShell deployment. First I creating a folder at:

c:/projects/Azure Toolkit
        

Then I downloaded the 2.7 version of the Azure Toolkit from Sitecore Downloads. I extracted the zip file to the Azure Toolkit directory that I just created. I also copied our Sitecore license file to this directory. Finally, I copied the azuredeploy.parameters.json file to this directory.

Deployment

Next, I followed the instructions at the end of this document. To choose a sitecoreSKU size, I used this article. I had to modify the default Azure toolkit powershell script for the Start-SitecoreAzureDeployment command because Sitecore assumed you will use a resource group name that is the same as the prefix for all app services. Because I'm using a different convention, I needed to create an additional parameter for the script that separates the resource group name and deployment id.

Finally, start the deployment with the following PowerShell commands:

Import-Module .\tools\Sitecore.Cloud.Cmdlets.psm1

$DeploymentId = "the-deployment-id"

$RGName = "resource-group"

$Location="my-location"

$SCTemplates="https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore 10.1.1/XM"

$ParamFile="c:\projects\Azure Toolkit\azuredeploy.parameters.json"

$LicenseFile = "c:\projects\Azure Toolkit\license.xml"

$Parameters = @{
    #set the size of all recommended instance sizes
    "sitecoreSKU"="Extra Small";

    #SOLR search
    "solrConnectionString"= "https://solr-app-service-name.azurewebsites.net/solr";
}

Start-SitecoreAzureDeployment -Name $DeploymentId -RgName $RGName -Location $Location -ArmTemplateUrl "$SCTemplates/azuredeploy.json" -ArmParametersPath $ParamFile  -LicenseXmlPath $LicenseFile  -SetKeyValue $Parameters