This commit is contained in:
Shawn Yuan
2026-02-12 14:29:42 +08:00
parent 2498f74f5c
commit 8b03e13247
3 changed files with 15 additions and 0 deletions

View File

@@ -151,6 +151,14 @@ function Download-ArtifactFromPipeline {
New-Item -ItemType Directory -Path $OutputDir -Force | Out-Null
try {
# Authenticate with Azure DevOps using System Access Token (if available)
if ($env:SYSTEM_ACCESSTOKEN) {
Write-Host "Authenticating with Azure DevOps using System Access Token..."
$env:AZURE_DEVOPS_EXT_PAT = $env:SYSTEM_ACCESSTOKEN
} else {
Write-Host "No SYSTEM_ACCESSTOKEN found, assuming az CLI is already authenticated..."
}
# Use az CLI to download artifact
$azArgs = "pipelines runs artifact download --organization $Organization --project $Project --run-id $BuildId --artifact-name `"$ArtifactName`" --path `"$OutputDir`""
Invoke-Expression "az $azArgs"

View File

@@ -1,3 +1,8 @@
# NOTE: When using artifact mode (useArtifactSource: true), the pipeline needs
# permission to access System.AccessToken. This is automatically handled by the
# script if SYSTEM_ACCESSTOKEN environment variable is available.
# If you encounter authentication errors, ensure the job has oauth access enabled.
trigger: none
pr: none
schedules:

View File

@@ -31,6 +31,8 @@ steps:
- task: PowerShell@2
displayName: Update WinAppSDK Versions
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\UpdateVersions.ps1'
arguments: >