Switch to User Delegate SAS for vcpkg caching (#5950)
This commit is contained in:
parent
7e9246794a
commit
11a61fa980
@ -8,7 +8,7 @@ steps:
|
||||
- task: AzurePowerShell@5
|
||||
displayName: Set Vcpkg Write-mode Cache
|
||||
inputs:
|
||||
azureSubscription: 'cpp Resource Group'
|
||||
azureSubscription: 'Azure SDK Artifacts'
|
||||
ScriptType: FilePath
|
||||
ScriptPath: eng/scripts/Set-VcpkgWriteModeCache.ps1
|
||||
azurePowerShellVersion: LatestVersion
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
param(
|
||||
[string] $StorageAccountName = 'cppvcpkgcache',
|
||||
[string] $ResourceGroupName = 'cpp'
|
||||
[string] $StorageAccountName = 'cppvcpkgcache'
|
||||
)
|
||||
|
||||
|
||||
@ -27,25 +26,15 @@ $env:PSModulePath = $modulePaths -join $moduleSeperator
|
||||
|
||||
Install-ModuleIfNotInstalled "Az.Storage" "4.3.0" | Import-Module
|
||||
|
||||
$storageAccountKeys = Get-AzStorageAccountKey `
|
||||
-ResourceGroupName $ResourceGroupName `
|
||||
-Name $StorageAccountName
|
||||
|
||||
$ctx = New-AzStorageContext `
|
||||
-StorageAccountKey $storageAccountKeys[0].Value`
|
||||
-StorageAccountName $StorageAccountName
|
||||
-StorageAccountName $StorageAccountName `
|
||||
-UseConnectedAccount
|
||||
|
||||
$token = New-AzStorageAccountSASToken `
|
||||
-Service Blob `
|
||||
-ResourceType Object `
|
||||
$vcpkgBinarySourceSas = New-AzStorageContainerSASToken `
|
||||
-Name $StorageAccountName `
|
||||
-Permission "rwc" `
|
||||
-Context $ctx `
|
||||
-ExpiryTime (Get-Date).AddDays(1)
|
||||
|
||||
$vcpkgBinarySourceSas = $token
|
||||
if ($token.StartsWith('?')) {
|
||||
$vcpkgBinarySourceSas = $token.Substring(1)
|
||||
}
|
||||
-ExpiryTime (Get-Date).AddHours(1)
|
||||
|
||||
Write-Host "Ensure redaction of SAS tokens in logs"
|
||||
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SAS_TOKEN;issecret=true;]$vcpkgBinarySourceSas"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user