Skip to content

Instantly share code, notes, and snippets.

@deeja
Last active October 15, 2019 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deeja/9954b7edb747120227e6940bde2fc676 to your computer and use it in GitHub Desktop.
Save deeja/9954b7edb747120227e6940bde2fc676 to your computer and use it in GitHub Desktop.
Sitecore installation from XP ARM notes
  • Create certificate
  • Upload wdp files to a blob container. Get urls and SAS token to the root of that folder. Give it a decent timeframe.
  • Install Sitecore using SIF installation.
  • Put Databases into elastic pool
  • Move ConnectionStrings to the WebApp configuration
  • Copy down production databases (if this is uat or other type); Update passwords
  • Move AppSettings to the WebApp configurations
  • Download root for adding to base package
  • Remove ConnectionStrings entries from base
  • Remove AppSettings from base
  • Package using Zip at web root; use name and version for the benefit of octopus.
# Taken from Sitecore-Azure-Quickstart-Templates
$ErrorActionPreference = "Stop" # So it just doesn't keep going if something goes wrong.
# Specify the parameters for the deployment
$ArmTemplateUrl = "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%209.0.2/XPSingle/azuredeploy.json"
$ArmParametersPath = $PSScriptRoot + "\azuredeploy.parameters.json"
$licenseFilePath = $PSScriptRoot + "\license.xml"
# Specify the certificate file path and password if you want to deploy Sitecore 9.0 XP or XDB configurations
$certificateFilePath = $PSScriptRoot + "\DEV-Cert.pfx"
$certificatePassword = "SomePassword"
$certificateBlob = $null # set below
# Resource group name - also used for naming resources
$Name = "my-deployment-name"
$location = "uksouth"
$AzureSubscriptionId = "120a1284-8912-489d-be78-a474c37e14b3" # Not real ;)
# read the contents of your Sitecore license file
$licenseFileContent = Get-Content -Raw -Encoding UTF8 -Path $licenseFilePath | Out-String
# read the contents of your authentication certificate
if ($certificateFilePath) {
$certificateBlob = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes($certificateFilePath))
}
#region Create Params Object
# license file needs to be secure string and adding the params as a hashtable is the only way to do it
$additionalParams = New-Object -TypeName Hashtable
$params = Get-Content $ArmParametersPath -Raw | ConvertFrom-Json
if ($params | Get-Member -Name parameters) {
$params = $params.parameters
}
foreach($p in $params | Get-Member -MemberType *Property)
{
$additionalParams.Add($p.Name, $params.$($p.Name).value)
}
$additionalParams.Set_Item('licenseXml',$licenseFileContent)
$additionalParams.Set_Item('deploymentId',$Name)
$additionalParams.Set_Item('location',$location)
# Inject Certificate Blob and Password into the parameters
if ($certificateBlob) {
$additionalParams.Set_Item('authCertificateBlob',$certificateBlob)
}
if ($certificatePassword) {
$additionalParams.Set_Item('authCertificatePassword',$certificatePassword)
}
#endregion
#region Service Principle Details
# By default this script will prompt you for your Azure credentials but you can update the script to use an Azure Service Principal instead by following the details at the link below and updating the four variables below once you are done.
# https://azure.microsoft.com/en-us/documentation/articles/resource-group-authenticate-service-principal/
$UseServicePrincipal = $false
$TenantId = "SERVICE_PRINCIPAL_TENANT_ID"
$ApplicationId = "SERVICE_PRINCIPAL_APPLICATION_ID"
$ApplicationPassword = "SERVICE_PRINCIPAL_APPLICATION_PASSWORD"
#endregion
try
{
#region Validate Resouce Group Name
Write-Host "Validating Resource Group Name..."
if(!($Name -cmatch '^(?!.*--)[a-z0-9]{2}(|([a-z0-9\-]{0,37})[a-z0-9])$'))
{
Write-Error "Name should only contain lowercase letters, digits or dashes,
dash cannot be used in the first two or final character,
it cannot contain consecutive dashes and is limited between 2 and 40 characters in length!"
Break;
}
#endregion
Write-Host "Setting Azure RM Context..."
if($UseServicePrincipal -eq $true)
{
#region Use Service Principle
$secpasswd = ConvertTo-SecureString $ApplicationPassword -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ($ApplicationId, $secpasswd)
Login-AzAccount -ServicePrincipal -Tenant $TenantId -Credential $mycreds
Set-AzContext -SubscriptionID $AzureSubscriptionId -TenantId $TenantId
#endregion
}
else
{
Write-Host "Attempting Setting of context without login"
Login-AzAccount
Set-AzContext -SubscriptionID $AzureSubscriptionId
}
Write-Host "Check if resource group already exists..."
$notPresent = Get-AzResourceGroup -Name $Name -ev notPresent -ea 0
if (!$notPresent)
{
New-AzResourceGroup -Name $Name -Location $location
}
Write-Host "Starting ARM deployment..."
New-AzResourceGroupDeployment `
-Name $Name `
-ResourceGroupName $Name `
-TemplateUri $ArmTemplateUrl `
-TemplateParameterObject $additionalParams `
# -DeploymentDebugLogLevel All -Debug -Verbose
Write-Host "Deployment Complete."
}
catch
{
Write-Error $_.Exception.Message
Break
}
ALTER USER [coreuser] WITH PASSWORD=N'something'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment