Created
July 2, 2017 16:24
-
-
Save RobsonAutomator/dd164741d52fa25908f71d3273a31faa to your computer and use it in GitHub Desktop.
How to use shared access signatures (SAS) in an automated way during Sitecore deployment with Azure Toolkit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Modules Azure | |
# ############################################################################# | |
# Get SAS tokents | |
# | |
# AUTHOR: Robert Senktas | |
# BLOG: http://lets-share.senktas.net/2017/07/sitecore-on-azure-sas-token.html | |
# | |
# COMMENT: | |
# ############################################################################# | |
$storage = '<StorageAccountName>' | |
$resource = '<ResourceGroupName>' | |
$location = '<DataCenterLocation>' | |
$account = Get-AzureRmStorageAccount -ResourceGroupName $resource -Name $storage | |
# Gets SAS token to give access from master template to linked/nested templates | |
$templatelinkAccessToken = New-AzureStorageContainerSASToken 'sitecore-deploy' ` | |
-Permission r ` | |
-StartTime (Get-Date) ` | |
-ExpiryTime (Get-Date).AddHours(1) ` | |
-Context $account.Context ` | |
# Gets full URI with SAS token to master ARM template | |
$templateUri = New-AzureStorageBlobSASToken -Container 'sitecore-deploy' ` | |
-Blob 'xp0/azuredeploy.json' ` | |
-Permission r ` | |
-StartTime (Get-Date) ` | |
-ExpiryTime (Get-Date).AddHours(1) ` | |
-Context $account.Context ` | |
-FullUri | |
# Gets full URI to WDP package | |
$singleMsDeployPackageUrl = New-AzureStorageBlobSASToken -Container 'sitecore-wdp' ` | |
-Blob 'xp0/Sitecore 8.2 rev. 170407_single.scwdp.zip' ` | |
-Permission r ` | |
-StartTime (Get-Date) ` | |
-ExpiryTime (Get-Date).AddHours(1) ` | |
-Context $account.Context ` | |
-FullUri | |
#Pass URLs to Sitecore deployment script | |
$setKeyValue = @{ | |
templatelinkAccessToken = $templatelinkAccessToken; | |
singleMsDeployPackageUrl = $singleMsDeployPackageUrl; | |
} | |
#Invoke Sitecore Deployment script | |
Start-SitecoreAzureDeployment -Location $location ` | |
-Name "sitecore82-170407" ` | |
-ArmTemplateUrl $templateUri ` | |
-ArmParametersPath "C:\SitecoreInstall\Azure\xp0\azuredeploy.parameters.json" ` | |
-LicenseXmlPath "C:\SitecoreInstall\Azure\license.xml" ` | |
-SetKeyValue $SetKeyValue ` | |
-Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment