Skip to content

Commit d7e2cc4

Browse files
authored
[ci] Update OneLocBuildToken (#8973)
Update the token in the Localization step to one backed by a managed identity.
1 parent a2b75ee commit d7e2cc4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

build-tools/automation/onelocbuild.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ jobs:
3434
filePath: $(Build.SourcesDirectory)\Localize\update-locproject.ps1
3535
arguments: -SourcesDirectory "$(Build.SourcesDirectory)" -LocProjectPath "$(Build.SourcesDirectory)\Localize\LocProject.json"
3636

37+
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance#authentication-from-pipelines
38+
# Requires Azure client 2.x
39+
- task: AzureCLI@2
40+
displayName: 'Set AzDO.OneLocBuildToken'
41+
enabled: true
42+
inputs:
43+
azureSubscription: 'VSEng-AzureDevOps-ceapex-OneLocBuild' # Azure DevOps service connection
44+
scriptType: 'pscore'
45+
scriptLocation: 'inlineScript'
46+
inlineScript: |
47+
# if this fails, check out this bash script that includes diagnostics:
48+
# https://gist.github.com/johnterickson/19f80a3e969e39f1000d118739176e62
49+
# Note that the resource is specified to limit the token to Azure DevOps
50+
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
51+
Write-Host "##vso[task.setvariable variable=AzDO.OneLocBuildToken;issecret=true]${token}"
52+
3753
- task: OneLocBuild@2
3854
displayName: OneLocBuild
3955
env:
@@ -42,7 +58,7 @@ jobs:
4258
locProj: Localize/LocProject.json
4359
outDir: $(Build.StagingDirectory)
4460
packageSourceAuth: patAuth
45-
patVariable: $(OneLocBuild--PAT)
61+
patVariable: $(AzDO.OneLocBuildToken)
4662
isCreatePrSelected: true
4763
repoType: gitHub
4864
gitHubPatVariable: $(github--pat--vs-mobiletools-engineering-service2)

0 commit comments

Comments
 (0)