Skip to content

Commit 87e1f2a

Browse files
[release/6.0] [release/8.0] Work around /'s in SAS query strings (#15158)
Co-authored-by: Matt Mitchell (.NET) <[email protected]>
1 parent bb06ac2 commit 87e1f2a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ 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. https://github.com/dotnet/dnceng/issues/3484
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
36+
if ($LASTEXITCODE -ne 0) {
37+
Write-Error "Failed to generate SAS token."
38+
exit 1
39+
}
40+
} while($sas.IndexOf('/') -ne -1)
3241
3342
if ($LASTEXITCODE -ne 0) {
3443
Write-Error "Failed to generate SAS token."

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ 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. https://github.com/dotnet/dnceng/issues/3484
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
36+
if ($LASTEXITCODE -ne 0) {
37+
Write-Error "Failed to generate SAS token."
38+
exit 1
39+
}
40+
} while($sas.IndexOf('/') -ne -1)
3241
3342
if ($LASTEXITCODE -ne 0) {
3443
Write-Error "Failed to generate SAS token."

0 commit comments

Comments
 (0)