Sitecore Azure ARM

Created: 24 Jun 2017, last update: 30 Jan 2022

Sitecore Azure ARM Possible Errors

Possible errors while running the Sitecore Azure Quickstart Templates with Windows PowerShell. An error or an incorrect assumption can be made quickly while provisioning Sitecore on Azure. The error description of things that go wrong is not always as clear. Here are some error situations you can get when running the Azure Resource Manager templates for installing Sitecore.

Example Windows PowerShell script for Sitecore 8.2 update 3

cd "C:\projects\AzureSitecore\toolkit"
Import-Module .\tools\Sitecore.Cloud.Cmdlets.psm1 -Verbose 


#Azure Subscription ID – and TenatId, Remove The TenantId parameter if you do no have one.
$SubscriptionId = "10000000-0000-0000-0000-a00000000000";
$TenantId = "a0000000-0000-0000-0000-a00000000000"; 


# Try get subscription, if not available then login first and then try again
Try { 

	Get-AzureRmSubscription -SubscriptionId $SubscriptionId -TenantId $TenantId

} Catch {

	# Use the credentials to download account setings and a list of accessible subscriptions.
	Login-AzureRMAccount -SubscriptionId $SubscriptionId -TenantId $TenantId

} 


$licenseFile = "C:\jbldev\license.xml" 
$ArmTemplateUrl = "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore 8.2.3/xm/azuredeploy.json";
$ArmParametersPath = "C:\jbldev\azuredeploy.parameters.json";
$RGName = "jbluemink-sit";
$DeploymentID = "jbldev-sit-" 
$location = "West Europe";


Start-SitecoreAzureDeployment -location $location -Name $RGName -ArmTemplateUrl $ ArmTemplateUrl -ArmParametersPath $ArmParametersPath -LicenseXmlPath $licenseFile

If you supply a ArmTemplatePath like c:\Sitecore-Azure-Quickstart-Templates\master\Sitecore 8.2.3\xm\azuredeploy.json to the ArmTemplateUrl parameter instead of a Url you get the following error:

Deployment Started...
New-AzureRmResourceGroupDeployment : 21:08:27 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'templateLinkBase' at line '28' and column '30' is not 
valid: The language expression property 'templateLink' doesn't exist, available properties are 'template, parameters, mode, provisioningState'.. Please see https://aka.ms/arm-template-expressions for 
usage details.'.
At C:\projects\AzureSitecore\toolkit\tools\Sitecore.Cloud.Cmdlets.psm1:115 char:35
+             $PSResGrpDeployment = New-AzureRmResourceGroupDeployment -Name $Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
 
New-AzureRmResourceGroupDeployment : The deployment validation failed
At C:\projects\AzureSitecore\toolkit\tools\Sitecore.Cloud.Cmdlets.psm1:115 char:35
+             $PSResGrpDeployment = New-AzureRmResourceGroupDeployment -Name $Name ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureRmResourceGroupDeployment], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

This is because the 8.2.3 templates use templateLink for nested templated the 8.1 templates do not use that. And the could run locally, but the 8.2.3 templates are designed to use from a URL.

In some cases the templateLink fail because it do a space replace, "[uri(replace(deployment().properties.templateLink.uri,' ','%20'), '.')]" if you encounter the following error try to url with a space instead of a %20 use "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore 8.2.3/xm/azuredeploy.json"; insteed of "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%208.2.3/xm/azuredeploy.json";

Error code InvalidTemplate
Message
Deployment template parse failed: 'Unexpected character encountered while parsing value: <. Path '', line 7, position 1.'.

Unblock downloaded dll
You need the latest AzureSitecore toolkit, download it. And Import

cd "C:\projects\AzureSitecore\toolkit"
Import-Module .\tools\Sitecore.Cloud.Cmdlets.psm1 -Verbose 

 You can get this error:

VERBOSE: Loading module from path 'C:\projects\AzureSitecore\toolkit10\tools\Sitecore.Cloud.Cmdlets.psm1'.
Import-Module : Could not load file or assembly 'file:///C:\projects\AzureSitecore\toolkit\tools\Sitecore.Cloud.Cmdlets.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At C:\projects\AzureSitecore\toolkit\tools\Sitecore.Cloud.Cmdlets.psm1:1 char:1
+ Import-Module "$PSScriptRoot\Sitecore.Cloud.Cmdlets.dll"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

This is because you need to unblock the Sitecore.Cloud.Cmdlets.dll in Windows File Explorer locate the dll, open properties and Unblock. This file came from another computer and might be blocked to help protect this computer. Also do not use toolkit 10 for Sitecore 8.1.3 use toolkit 11, else you get this error:

Start-SitecoreAzureDeployment : The term 'Set-SCArmParameters' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\jbluemink\Documents\WindowsPowerShell\Sitecoredeploy2fail1.ps1:37 char:1
+ Start-SitecoreAzureDeployment -location $location -Name $RGName -ArmTemplatePath ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Start-SitecoreAzureDeployment>




This error about Azure SQL default compatibility level:

The resource operation completed with terminal provisioning state 

AppGallery Deploy Failed: 'Microsoft.Web.Deployment.DeploymentDetailedClientServerException: 
Could not deploy package. Unable to connect to master or target server ''. 
You must have a user with the same password in master or target server ''.

Microsoft.SqlServer.Dac.DacServicesException: Could not deploy package.
Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: 
Unable to connect to master or target server ''. 
You must have a user with the same password in master or target server ''.

Is descript at https://kb.sitecore.net/articles/755670

 

For errors about Microsoft.Insights/Components/CurrentBillingFeatures see https://sitecore.stackexchange.com/questions/7377/azure-quickstart-templates-xp-config-error-microsoft-insights-components-curr

 

Links:
Sitecore/Sitecore-Azure-Quickstart-Templates
Sitecore Azure Toolkit 1.1 rev. 170509