Skip to content

Commit d6dfe4a

Browse files
authored
[ci] Update OneLocBuildToken (#1220)
Update the token in the Localization step to one backed by a managed identity.
1 parent 78d5937 commit d6dfe4a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@ jobs:
173173
- checkout: self
174174
clean: true
175175

176+
# 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
177+
# Requires Azure client 2.x
178+
- task: AzureCLI@2
179+
displayName: 'Set AzDO.OneLocBuildToken'
180+
enabled: true
181+
inputs:
182+
azureSubscription: 'VSEng-AzureDevOps-ceapex-OneLocBuild' # Azure DevOps service connection
183+
scriptType: 'pscore'
184+
scriptLocation: 'inlineScript'
185+
inlineScript: |
186+
# if this fails, check out this bash script that includes diagnostics:
187+
# https://gist.github.com/johnterickson/19f80a3e969e39f1000d118739176e62
188+
# Note that the resource is specified to limit the token to Azure DevOps
189+
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
190+
Write-Host "##vso[task.setvariable variable=AzDO.OneLocBuildToken;issecret=true]${token}"
191+
176192
- task: OneLocBuild@2
177193
displayName: OneLocBuild
178194
env:
@@ -181,7 +197,7 @@ jobs:
181197
locProj: Localize/LocProject.json
182198
outDir: $(Build.StagingDirectory)
183199
packageSourceAuth: patAuth
184-
patVariable: $(OneLocBuild--PAT)
200+
patVariable: $(AzDO.OneLocBuildToken)
185201
isCreatePrSelected: true
186202
repoType: gitHub
187203
gitHubPatVariable: $(github--pat--vs-mobiletools-engineering-service2)

0 commit comments

Comments
 (0)