Skip to content

Instantly share code, notes, and snippets.

@coreyasmith
Last active November 13, 2019 10:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreyasmith/d3ea626acf6e1c98157efb3ced48b0fd to your computer and use it in GitHub Desktop.
Save coreyasmith/d3ea626acf6e1c98157efb3ced48b0fd to your computer and use it in GitHub Desktop.
PowerShell snippet and ARM templates for deploying Sitecore modules to XP Scaled environments.
# Make sure to import `Sitecore.Cloud.Cmdlets.dll` and not `Sitecore.Cloud.Cmdlets.psm1`
Import-Module C:\Sitecore\sat\tools\Sitecore.Cloud.Cmdlets.dll
$packagePath = "C:\Sitecore\Packages"
Remove-SCDatabaseOperations `
-Path "$packagePath\Sitecore JavaScript Services Tech Preview Server 9.0.1 rev. 180724.scwdp.zip" `
-Destination $packagePath `
-Verbose `
-Force
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"modules": {
"value": {
"items": [
{
"name" : "jss",
"templateLink": "<URL of the scaled-sitecore-module.json>",
"parameters": {
"cmMsDeployPackageUrl": "<URL of the WDP file Sitecore JavaScript Services Tech Preview Server *.scwdp.zip>",
"cdMsDeployPackageUrl": "<URL of the WDP file Sitecore JavaScript Services Tech Preview Server *.withoutdb.scwdp.zip>"
}
},
{
"name": "bootloader",
"templateLink": "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%209.0.2/XP/addons/bootloader.json",
"parameters": {
"msDeployPackageUrl": "<URL of the WDP file Sitecore.Cloud.Integration.Bootload.wdp.zip>"
}
}
]
}
}
}
}
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"webApiVersion": "2016-08-01",
"resourcesApiVersion": "2016-09-01",
"sqlServerFqdnTidy": "[toLower(trim(parameters('sqlServerFqdn')))]",
"coreSqlDatabaseNameTidy": "[toLower(trim(parameters('coreSqlDatabaseName')))]",
"masterSqlDatabaseNameTidy": "[toLower(trim(parameters('masterSqlDatabaseName')))]",
"cdWebAppNameTidy": "[toLower(trim(parameters('cdWebAppName')))]",
"cmWebAppNameTidy": "[toLower(trim(parameters('cmWebAppName')))]"
},
"parameters": {
"standard": {
"type": "secureObject",
"defaultValue": {
"infrastructure": {
"sqlServerFqdn": null
},
"deploymentId": null,
"location": null,
"sqlServerLogin": null,
"sqlServerPassword": null,
"coreSqlDatabaseName": null,
"masterSqlDatabaseName": null,
"cdWebAppName": null,
"cmWebAppName": null
}
},
"extension": {
"type": "secureObject",
"defaultValue": {
"cdMsDeployPackageUrl": null,
"cmMsDeployPackageUrl": null
}
},
"templateLinkBase": {
"type": "string",
"minLength": 1,
"defaultValue": "[uri(replace(json(string(deployment().properties.templateLink)).uri,' ','%20'), '.')]"
},
"deploymentId": {
"type": "string",
"defaultValue": "[coalesce(parameters('standard').deploymentId, resourceGroup().name)]"
},
"location": {
"type": "string",
"minLength": 1,
"defaultValue": "[coalesce(parameters('standard').location, resourceGroup().location)]"
},
"sqlServerFqdn": {
"type": "string",
"minLength": 1,
"defaultValue": "[coalesce(parameters('standard').infrastructure.sqlServerFqdn, concat(parameters('deploymentId'), '-sql.database.windows.net'))]"
},
"sqlServerLogin": {
"type": "string",
"minLength": 1,
"defaultValue": "[parameters('standard').sqlServerLogin]"
},
"sqlServerPassword": {
"type": "securestring",
"minLength": 8,
"defaultValue": "[parameters('standard').sqlServerPassword]"
},
"coreSqlDatabaseName": {
"type": "string",
"minLength": 1,
"defaultValue": "[coalesce(parameters('standard').coreSqlDatabaseName, concat(parameters('deploymentId'), '-core-db'))]"
},
"masterSqlDatabaseName": {
"type": "string",
"minLength": 1,
"defaultValue": "[coalesce(parameters('standard').masterSqlDatabaseName, concat(parameters('deploymentId'), '-master-db'))]"
},
"cdWebAppName": {
"type": "string",
"minLength": 1,
"defaultValue": "[coalesce(parameters('standard').cdWebAppName, concat(parameters('deploymentId'), '-cd'))]"
},
"cmWebAppName": {
"type": "string",
"minLength": 1,
"defaultValue": "[coalesce(parameters('standard').cmWebAppName, concat(parameters('deploymentId'), '-cm'))]"
},
"cdMsDeployPackageUrl": {
"type": "securestring",
"minLength": 1,
"defaultValue": "[parameters('extension').cdMsDeployPackageUrl]"
},
"cmMsDeployPackageUrl": {
"type": "securestring",
"minLength": 1,
"defaultValue": "[parameters('extension').cmMsDeployPackageUrl]"
}
},
"resources": [
{
"name": "[concat(variables('cmWebAppNameTidy'), '/', 'MSDeploy')]",
"type": "Microsoft.Web/sites/extensions",
"location": "[parameters('location')]",
"apiVersion": "[variables('webApiVersion')]",
"properties": {
"mode": "Incremental",
"addOnPackages": [
{
"packageUri": "[parameters('cmMsDeployPackageUrl')]",
"dbType": "SQL",
"connectionString": "[concat('Data Source=tcp:', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=master;User Id=', parameters('sqlServerLogin'), ';Password=', parameters('sqlServerPassword'), ';')]",
"setParameters": {
"Application Path": "[variables('cmWebAppNameTidy')]",
"Core Admin Connection String": "[concat('Encrypt=True;TrustServerCertificate=False;Data Source=', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=',variables('coreSqlDatabaseNameTidy'),';User Id=', parameters('sqlServerLogin'), ';Password=', parameters('sqlServerPassword'), ';')]",
"Master Admin Connection String": "[concat('Encrypt=True;TrustServerCertificate=False;Data Source=', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=',variables('masterSqlDatabaseNameTidy'),';User Id=', parameters('sqlServerLogin'), ';Password=', parameters('sqlServerPassword'), ';')]"
}
}
]
}
},
{
"name": "[concat(variables('cdWebAppNameTidy'), '/', 'MSDeploy')]",
"type": "Microsoft.Web/sites/extensions",
"location": "[parameters('location')]",
"apiVersion": "[variables('webApiVersion')]",
"properties": {
"mode": "Incremental",
"addOnPackages": [
{
"packageUri": "[parameters('cdMsDeployPackageUrl')]",
"setParameters": {
"Application Path": "[variables('cdWebAppNameTidy')]",
"Core Admin Connection String": "[concat('Encrypt=True;TrustServerCertificate=False;Data Source=', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=',variables('coreSqlDatabaseNameTidy'),';User Id=', parameters('sqlServerLogin'), ';Password=', parameters('sqlServerPassword'), ';')]",
"Master Admin Connection String": "[concat('Encrypt=True;TrustServerCertificate=False;Data Source=', variables('sqlServerFqdnTidy'), ',1433;Initial Catalog=',variables('masterSqlDatabaseNameTidy'),';User Id=', parameters('sqlServerLogin'), ';Password=', parameters('sqlServerPassword'), ';')]"
}
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment