azure-sdk-for-cpp/eng/common/scripts/Set-VcpkgWriteModeCache.ps1
Azure SDK Bot 176e49d722
Sync eng/common directory with azure-sdk-tools for PR 12301 (#6762)
* Set up vcpkg cache variables in eng/common

* Paths

* Remove module code, it's not necessary anymore

* Review feedback: Write-Host -> #

---------

Co-authored-by: Daniel Jurek <djurek@microsoft.com>
2025-10-07 11:34:36 -07:00

23 lines
1.0 KiB
PowerShell
Executable File

#!/bin/env pwsh
param(
[string] $StorageAccountName = 'azuresdkartifacts',
[string] $StorageContainerName = 'public-vcpkg-container'
)
$ctx = New-AzStorageContext `
-StorageAccountName $StorageAccountName `
-UseConnectedAccount
$vcpkgBinarySourceSas = New-AzStorageContainerSASToken `
-Name $StorageContainerName `
-Permission "rwcl" `
-Context $ctx `
-ExpiryTime (Get-Date).AddHours(1)
# Ensure redaction of SAS tokens in logs
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SAS_TOKEN;issecret=true;]$vcpkgBinarySourceSas"
Write-Host "Setting vcpkg binary cache to read and write"
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azcopy-sas,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite"
Write-Host "##vso[task.setvariable variable=X_VCPKG_ASSET_SOURCES_SECRET;issecret=true;]clear;x-azurl,https://$StorageAccountName.blob.core.windows.net/$StorageContainerName,$vcpkgBinarySourceSas,readwrite"