diff --git a/.gitignore b/.gitignore index 1313cce414..b43080b515 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,5 @@ packages/ tools/* !tools/packages.config -/Azure PaaS/Cake/tools/* -!/Azure PaaS/Cake/tools/packages.config \ No newline at end of file +/Azure PaaS/tools/* +!/Azure PaaS/tools/packages.config \ No newline at end of file diff --git a/Azure PaaS/Cake/CakeScripts/helper-methods.cake b/Azure PaaS/CakeScripts/helper-methods.cake similarity index 100% rename from Azure PaaS/Cake/CakeScripts/helper-methods.cake rename to Azure PaaS/CakeScripts/helper-methods.cake diff --git a/Azure PaaS/HelperScripts/AzureUser-Config-Capture.ps1 b/Azure PaaS/HelperScripts/AzureUser-Config-Capture.ps1 index 87e0474de5..5031e6e23c 100644 --- a/Azure PaaS/HelperScripts/AzureUser-Config-Capture.ps1 +++ b/Azure PaaS/HelperScripts/AzureUser-Config-Capture.ps1 @@ -50,7 +50,7 @@ if (!$azureuserconfig) { ######################## # Get Azure Credentials ######################## -<# + Write-Host "Importing and Installing AzureRm Module" $AzureModule = Get-Module -ListAvailable AzureRM @@ -64,11 +64,13 @@ Import-Module AzureRM Enable-AzureRmContextAutosave Add-AzureRmAccount -#> + ########################################### # Get User Input for azureuser-config.json ########################################### +Write-host "Please Enter Azure Settings" + foreach ($setting in $azureuserconfig.settings) { switch ($setting.id) diff --git a/Azure PaaS/HelperScripts/Env-Prep.ps1 b/Azure PaaS/HelperScripts/Env-Prep.ps1 index 6a3e811330..47b80f6d0f 100644 --- a/Azure PaaS/HelperScripts/Env-Prep.ps1 +++ b/Azure PaaS/HelperScripts/Env-Prep.ps1 @@ -1,19 +1,23 @@ <# + .SYNOPSIS + Prepare Local environnment for habitat home scwdp package creation + + .DESCRIPTION This script will check the local Deploy folder defined in the cake-config.json file for an Assets folder, and create one if it doesn't exist. It will then check the folder for prerequisite files as defined by the assets.json. - The script will then download anything missing and extract tools so they can be used by later scripts. + The script will then download anything missing and extract tools and files so they can be used by later scripts. #> Param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $ConfigurationFile, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory=$true, HelpMessage="Please Enter your dev.sitecore.com username")] [ValidateNotNullOrEmpty()] - [string] $Username, - [Parameter(Mandatory=$true)] + [string] $SitecoreDownloadUsername, + [Parameter(Mandatory=$true, HelpMessage="Please Enter your dev.sitecore.com password")] [ValidateNotNullOrEmpty()] - [Security.SecureString] $Password + [Security.SecureString] $SitecoreDownloadPassword ) ########################### @@ -61,7 +65,7 @@ $foundfiles = New-Object System.Collections.ArrayList $downloadlist = New-Object System.Collections.ArrayList $assetsfolder = (Join-Path $config.DeployFolder assets) [string] $habitathomefilepath = $([io.path]::combine($config.DeployFolder, 'Website', 'HabitatHome')) -$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password +$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $SitecoreDownloadUsername, $SitecoreDownloadPassword ################################################## # Check for existing Files in Deploy\Assets Folder @@ -160,8 +164,6 @@ else # Download Required Files ########################### - Import-Module "$($PSScriptRoot)\DownloadFileWithCredentials\DownloadFileWithCredentials.psm1" -Force - Function Download-Asset { param( [PSCustomObject] $assetfilename, @@ -188,7 +190,8 @@ else Assetfilename = $assetfilename TypeSource = $sourceType } - + Import-Module "$($PSScriptRoot)\DownloadFileWithCredentials\DownloadFileWithCredentials.psm1" -Force + Invoke-DownloadFileWithCredentialsTask @params } diff --git a/Azure PaaS/HelperScripts/Generate-HabitatUpdatePackages.ps1 b/Azure PaaS/HelperScripts/Generate-HabitatUpdatePackages.ps1 index 7df421cbb8..7efe7770c8 100644 --- a/Azure PaaS/HelperScripts/Generate-HabitatUpdatePackages.ps1 +++ b/Azure PaaS/HelperScripts/Generate-HabitatUpdatePackages.ps1 @@ -47,7 +47,7 @@ Function Process-UpdatePackage([PSObject] $Configuration, [String] $FolderString $updateFile = Join-Path $([IO.Path]::Combine($Configuration.DeployFolder, 'assets', $targetFolderName)) "$($targetFolderName).update" $courierPath = $([IO.Path]::Combine($Configuration.DeployFolder, 'assets', 'Sitecore Courier')) - GenerateUpdatePackage -pathToCourier "$($courierPath)\Sitecore.Courier.Runner.exe" -configFile $Configuration -argSourcePackagingFolder $sourceFolder -argOutputPackageFile $updateFile + GenerateUpdatePackage -configFile $Configuration -argSourcePackagingFolder $sourceFolder -argOutputPackageFile $updateFile } @@ -58,8 +58,6 @@ Function Process-UpdatePackage([PSObject] $Configuration, [String] $FolderString Function GenerateUpdatePackage(){ Param( - [parameter(Mandatory=$true)] - [String] $pathToCourier, [parameter(Mandatory=$true)] [String] $configFile, [String] $argSourcePackagingFolder, @@ -67,9 +65,6 @@ Function GenerateUpdatePackage(){ ) - - # heres the code for the powershell module version of courier if we want to use that in the future - Set-PSRepository -Name PSGallery -InstallationPolicy Trusted Install-Module -Name Sitecore.Courier diff --git a/Azure PaaS/HelperScripts/Upload-Packages.ps1 b/Azure PaaS/HelperScripts/Upload-Packages.ps1 index d7e811193c..b4288647f7 100644 --- a/Azure PaaS/HelperScripts/Upload-Packages.ps1 +++ b/Azure PaaS/HelperScripts/Upload-Packages.ps1 @@ -161,7 +161,7 @@ Function UploadWDPs ([PSCustomObject] $cakeConfigFile, [PSCustomObject] $assetsC # Upload Habitat WDPs - $habitatWebsiteWDPPath = [IO.Path]::Combine($assetsFolder, 'website', 'convert to WDP', 'WDP', 'website_single.scwdp.zip') + $habitatWebsiteWDPPath = [IO.Path]::Combine($assetsFolder, 'habitathome', 'convert to WDP', 'WDP', 'habitathome_single.scwdp.zip') if((Test-Path $habitatWebsiteWDPPath) -eq $True){ $habitatWebsiteWDPFile = Get-Item -Path $habitatWebsiteWDPPath @@ -212,7 +212,7 @@ Function UploadFiles ([PSCustomObject] $cakeConfigFile){ $azuredeployArmTemplate = Get-Item -Path $([IO.Path]::Combine($config.ProjectFolder, 'Azure Paas', 'XP0 Single', 'azuredeploy.json')) $sxaArmTemplate = Get-Item -Path $([IO.Path]::Combine($config.ProjectFolder, 'Azure Paas', 'ARM Templates', 'Modules', 'Sitecore Experience Accelerator', 'sxa_module.json')) $defArmTemplate = Get-Item -Path $([IO.Path]::Combine($config.ProjectFolder, 'Azure Paas', 'ARM Templates', 'Modules', 'Data Exchange Framework', 'def_module.json')) - $habitatWebsiteArmTemplate = Get-Item -Path $([IO.Path]::Combine($config.ProjectFolder, 'Azure Paas', 'ARM Templates', 'Habitat', 'website.json')) + $habitatWebsiteArmTemplate = Get-Item -Path $([IO.Path]::Combine($config.ProjectFolder, 'Azure Paas', 'ARM Templates', 'Habitat', 'habitathome.json')) $habitatXconnectArmTemplate = Get-Item -Path $([IO.Path]::Combine($config.ProjectFolder, 'Azure Paas', 'ARM Templates', 'Habitat', 'xconnect.json')) $bootloadArmTemplate = Get-Item -Path $([IO.Path]::Combine($config.ProjectFolder, 'Azure Paas', 'XP0 Single', 'addons', 'bootloader.json')) @@ -307,7 +307,7 @@ $originalContainerName = "azure-toolkit" $additionalContainerName = "temporary-toolkit" - +<# # Check the Azure PowerShell Module's version $AzureModule = Get-Module -ListAvailable AzureRM if ($AzureModule -eq ""){ @@ -324,7 +324,7 @@ Import-Module AzureRM Enable-AzureRmContextAutosave Add-AzureRmAccount - +#> # Connect to Azure with an interactive dialog for sign-in #Connect-AzureRmAccount @@ -475,7 +475,7 @@ ForEach($blob in $blobsList){ $xcSingleMsDeployPackageUrl = (Get-AzureStorageBlob -Blob $blob.Name -Container $containerName -Context $ctx).ICloudBlob.uri.AbsoluteUri } - "wdps/website_single.scwdp.zip" + "wdps/habitathome_single.scwdp.zip" { $habitatWebsiteDeployPackageUrl = (Get-AzureStorageBlob -Blob $blob.Name -Container $containerName -Context $ctx).ICloudBlob.uri.AbsoluteUri @@ -509,7 +509,7 @@ ForEach ($blob in $blobsList){ $defTemplateLink = (Get-AzureStorageBlob -Blob $blob.Name -Container $containerName -Context $ctx).ICloudBlob.uri.AbsoluteUri - } elseif($blob.Name -like "*website.json"){ + } elseif($blob.Name -like "*habitathome.json"){ $habitatWebsiteTemplateLink = (Get-AzureStorageBlob -Blob $blob.Name -Container $containerName -Context $ctx).ICloudBlob.uri.AbsoluteUri diff --git a/Azure PaaS/README.md b/Azure PaaS/README.md index baeaa6a296..67e57c8a30 100644 --- a/Azure PaaS/README.md +++ b/Azure PaaS/README.md @@ -54,25 +54,48 @@ The following is a list of default values/assumptions for install locations **Project Folder** `c:\projects\sitecore.habitathome.content\` **Deploy Folder** `c:\Deploy` -if these values are not correct you will need to edit the cake-config.json in the `\Azure PaaS\Cake` folder. +if these values are not correct you will need to edit the cake-config.json in the `\Azure PaaS` folder. -### 3. Environment Preparation +### 3. Deploy Sitecore.HabitatHome.Content -From the `Sitecore.HabitatHome.Content\Azure PaaS\HelperScripts` folder - -- Run **`Env-Prep.ps1 -ConfigurationFile "See Below"`** - -For the `-ConfigurationFile` parameter please provde the full path to the `cake-config.json` located in your `\Azure PaaS\Cake folder` - -This will prompt you for your dev.sitecore.com username and password. - -### 4. Deploy Sitecore.HabitatHome.Content - -From the `\Azure PaaS\Cake` folder +From the `\Azure PaaS` folder - Run **`.\build.ps1`** -### 5. Validating deployment +Optional Parameters: +|Parameter | Description +|-------------------------------------------|--------------------------------------------------------------------------------------------- +| Verbosity | Specifies the amount of information to be displayed +| ShowDescription | Shows description about tasks. +| DryRun | Performs a dry run. +| SkipToolPackageRestore | Skips restoring of packages. +| Target | Build Target **(see below)** + +**Target** +|Value | Description +|-------------------------------------------|--------------------------------------------------------------------------------------------- +| Default | Same affect as no target defined, will build and deploy to Azure. +| Build | Create build output only, will **not** upload or deploy to Zzure +| Azure-Upload | Performs only the upload to Azure portion of the process +| Azure-Deploy | Performs only the Deployment portion of the process + +##### Environment Preparation + +This script will prompt you for information regarding your build and deployment + +|Parameter | Description +|-------------------------------------------|--------------------------------------------------------------------------------------------- +| SitecoreDownloadUsername | dev.sitecore.com username +| SitecoreDownloadPassword | dev.sitecore.com password +| AzureDeploymentID | Resource group name. +| AzureRegion | The geographical region of the current deployment. +| SitecoreLoginAdminPassword | The new password for the Sitecore **admin** account. (8 Character Minimum) +| SqlServerLoginAdminAccount | The name of the administrator account for Azure SQL server that will be created. SA is not a valid login +| SqlServerLoginAdminPassword | The password for the administrator account for Azure SQL server. +| XConnectCertfilePath | A Base64-encoded blob of the authentication certificate in PKCS #12 format. +| XConnectCertificatePassword | A password to the authentication certificate. + +### 4. Validating deployment ##### The hostname habitathome.dev.local is used in the SXA Hostname (Site Grouping). diff --git a/Azure PaaS/XP0 Single/README.md b/Azure PaaS/XP0 Single/README.md index 3b6332c844..9807e6ed8f 100644 --- a/Azure PaaS/XP0 Single/README.md +++ b/Azure PaaS/XP0 Single/README.md @@ -2,7 +2,7 @@ ## Instructions -Please follow the instructions on the [Azure PaaS Readme](Azure PaaS/Readme.md) +Please follow the instructions on the [Azure PaaS Readme](../Readme.md) ## Resources provisioned: diff --git a/Azure PaaS/Cake/build.cake b/Azure PaaS/build.cake similarity index 85% rename from Azure PaaS/Cake/build.cake rename to Azure PaaS/build.cake index 82536fdf82..0533c18745 100644 --- a/Azure PaaS/Cake/build.cake +++ b/Azure PaaS/build.cake @@ -40,8 +40,33 @@ Task("Default") //.IsDependentOn("Rebuild-Master-Index") //.IsDependentOn("Rebuild-Web-Index") .IsDependentOn("Publish-YML") +.IsDependentOn("Package-Build") +.IsDependentOn("Azure-Upload-Packages") +.IsDependentOn("Azure-Site-Deploy"); + +Task("Build") +.WithCriteria(configuration != null) +.IsDependentOn("Clean") +.IsDependentOn("Publish-All-Projects") +.IsDependentOn("Apply-Xml-Transform") +.IsDependentOn("Publish-Transforms") +.IsDependentOn("Publish-xConnect-Project") + //.IsDependentOn("Deploy-EXM-Campaigns") + //.IsDependentOn("Deploy-Marketing-Definitions") + //.IsDependentOn("Rebuild-Core-Index") + //.IsDependentOn("Rebuild-Master-Index") + //.IsDependentOn("Rebuild-Web-Index") +.IsDependentOn("Publish-YML") .IsDependentOn("Package-Build"); +Task("Azure-Upload") +.WithCriteria(configuration != null) +.IsDependentOn("Azure-Upload-Packages"); + +Task("Azure-Deploy") +.WithCriteria(configuration != null) +.IsDependentOn("Azure-Site-Deploy"); + /*=============================================== ================= SUB TASKS ===================== ===============================================*/ @@ -149,7 +174,7 @@ Task("Publish-YML").Does(() => { StartPowershellFile (($"{configuration.ProjectFolder}\\Azure PaaS\\HelperScripts\\Publish-YML.ps1"), args => { - args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\Cake\\cake-config.json"); + args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\cake-config.json"); }); }); @@ -160,32 +185,28 @@ Task("Package-Build") Task("Generate-HabitatUpdatePackages").Does(() => { StartPowershellFile ($"{configuration.ProjectFolder}\\Azure PaaS\\HelperScripts\\Generate-HabitatUpdatePackages.ps1", args => { - args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\Cake\\cake-config.json"); + args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\cake-config.json"); }); }); Task("ConvertTo-SCWDPs").Does(() => { StartPowershellFile ($"{configuration.ProjectFolder}\\Azure PaaS\\HelperScripts\\ConvertTo-SCWDPs.ps1", args => { - args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\Cake\\cake-config.json"); + args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\cake-config.json"); }); }); -Task("Azure-Deploy") -.IsDependentOn("Upload-Packages") -.IsDependentOn("Site-Deploy"); - -Task("Upload-Packages").Does(() => { +Task("Azure-Upload-Packages").Does(() => { StartPowershellFile ($"{configuration.ProjectFolder}\\Azure PaaS\\HelperScripts\\Upload-Packages.ps1", args => { - args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\Cake\\cake-config.json"); + args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\cake-config.json"); }); }); -Task("Site-Deploy").Does(() => { +Task("Azure-Site-Deploy").Does(() => { StartPowershellFile ($"{configuration.ProjectFolder}\\Azure PaaS\\HelperScripts\\Azure-Deploy.ps1", args => { - args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\Cake\\cake-config.json"); + args.AppendQuoted($"{configuration.ProjectFolder}\\Azure PaaS\\cake-config.json"); }); }); diff --git a/Azure PaaS/Cake/build.ps1 b/Azure PaaS/build.ps1 similarity index 94% rename from Azure PaaS/Cake/build.ps1 rename to Azure PaaS/build.ps1 index f9c7db13d5..de1b8878d1 100644 --- a/Azure PaaS/Cake/build.ps1 +++ b/Azure PaaS/build.ps1 @@ -38,6 +38,7 @@ https://cakebuild.net [CmdletBinding()] Param( [string]$Script = "build.cake", + [ValidateSet("Default", "Build", "Azure-Upload", "Azure-Deploy")] [string]$Target, [string]$Configuration, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] @@ -50,6 +51,21 @@ Param( [string[]]$ScriptArgs ) +############################### +# Run AzureUser-Config-Capture +############################### + +if(($Target) -and ($Target -ne "Build") -or !($Target)) +{ + & ".\\HelperScripts\AzureUser-Config-Capture.ps1" -ConfigurationFile "cake-config.json" +} + +############################### +# Run Env-Prep +############################### + +& ".\\HelperScripts\Env-Prep.ps1" -ConfigurationFile "cake-config.json" + # Attempt to set highest encryption available for SecurityProtocol. # PowerShell will not set this by default (until maybe .NET 4.6.x). This # will typically produce a message for PowerShell v2 (just an info diff --git a/Azure PaaS/Cake/cake-config.json b/Azure PaaS/cake-config.json similarity index 100% rename from Azure PaaS/Cake/cake-config.json rename to Azure PaaS/cake-config.json diff --git a/Azure PaaS/Cake/tools/packages.config b/Azure PaaS/tools/packages.config similarity index 100% rename from Azure PaaS/Cake/tools/packages.config rename to Azure PaaS/tools/packages.config