Skip to content

Commit d917e14

Browse files
vseanreesermsftmmitche
authored andcommitted
Merged PR 41195: Updated get-delegation-sas.yml
#### AI description (iteration 1) #### PR Classification Bug fix to address an issue with SAS token generation. #### PR Summary This pull request updates the `get-delegation-sas.yml` script to handle a specific issue with SAS tokens containing slashes, which cause incorrect downloads of correlation payloads. - `get-delegation-sas.yml`: Added a loop to regenerate the SAS token if it contains a slash, ensuring valid token generation.
1 parent 8db1832 commit d917e14

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

eng/common/templates-official/steps/get-delegation-sas.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ steps:
2828
# Calculate the expiration of the SAS token and convert to UTC
2929
$expiry = (Get-Date).AddHours(${{ parameters.expiryInHours }}).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
3030
31-
$sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv
31+
# Temporarily work around a helix issue where SAS tokens with / in them will cause incorrect downloads
32+
# of correlation payloads.
33+
$sas = ""
34+
do {
35+
$sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv
3236
33-
if ($LASTEXITCODE -ne 0) {
34-
Write-Error "Failed to generate SAS token."
35-
exit 1
36-
}
37+
if ($LASTEXITCODE -ne 0) {
38+
Write-Error "Failed to generate SAS token."
39+
exit 1
40+
}
41+
} while($sas.IndexOf('/') -ne -1)
3742
3843
if ('${{ parameters.base64Encode }}' -eq 'true') {
3944
$sas = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($sas))

0 commit comments

Comments
 (0)