From 5d7458aa89e822691bd8c168b1a563832b7957d9 Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Tue, 27 Feb 2024 00:23:42 -0800 Subject: [PATCH] Fix the SAS token generation script (#36938) to account for breaking change in New-AzStorageContainerSASToken which causes it to no longer start with a question mark. See https://learn.microsoft.com/en-us/powershell/azure/release-notes-azureps?view=azps-11.3.0#azstorage-600 --- scripts/azure-pipelines/generate-sas-tokens.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/azure-pipelines/generate-sas-tokens.ps1 b/scripts/azure-pipelines/generate-sas-tokens.ps1 index 2b35c52bdb..9b9260e4e8 100644 --- a/scripts/azure-pipelines/generate-sas-tokens.ps1 +++ b/scripts/azure-pipelines/generate-sas-tokens.ps1 @@ -26,8 +26,12 @@ function Get-SasToken { $ctx = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $key.Value $start = Get-Date -AsUTC $end = $start.AddDays(90) - $token = New-AzStorageContainerSASToken -Name $ContainerName -Permission $Permission -StartTime $start -ExpiryTime $end -Context $ctx - return $token.Substring(1) + $token = New-AzStorageContainerSASToken -Name $ContainerName -Permission $Permission -StartTime $start -ExpiryTime $end -Context $ctx -Protocol HttpsOnly + if ($token.StartsWith('?')) { + $token = $token.Substring(1) + } + + return $token } # Asset Cache: