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
This commit is contained in:
Billy O'Neal 2024-02-27 00:23:42 -08:00 committed by GitHub
parent 89efa21f94
commit 5d7458aa89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,8 +26,12 @@ function Get-SasToken {
$ctx = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $key.Value $ctx = New-AzStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $key.Value
$start = Get-Date -AsUTC $start = Get-Date -AsUTC
$end = $start.AddDays(90) $end = $start.AddDays(90)
$token = New-AzStorageContainerSASToken -Name $ContainerName -Permission $Permission -StartTime $start -ExpiryTime $end -Context $ctx $token = New-AzStorageContainerSASToken -Name $ContainerName -Permission $Permission -StartTime $start -ExpiryTime $end -Context $ctx -Protocol HttpsOnly
return $token.Substring(1) if ($token.StartsWith('?')) {
$token = $token.Substring(1)
}
return $token
} }
# Asset Cache: # Asset Cache: