Skip to content

Commit 137ad81

Browse files
authored
[ci] Update OneLocBuildToken (#233)
Update the token in the Localization step to one backed by a managed identity.
1 parent 1ea4e35 commit 137ad81

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Localize/onelocbuild.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ jobs:
3333
- checkout: self
3434
clean: true
3535

36+
# 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
37+
# Requires Azure client 2.x
38+
- task: AzureCLI@2
39+
displayName: 'Set AzDO.OneLocBuildToken'
40+
enabled: true
41+
inputs:
42+
azureSubscription: 'VSEng-AzureDevOps-ceapex-OneLocBuild' # Azure DevOps service connection
43+
scriptType: 'pscore'
44+
scriptLocation: 'inlineScript'
45+
inlineScript: |
46+
# if this fails, check out this bash script that includes diagnostics:
47+
# https://gist.github.com/johnterickson/19f80a3e969e39f1000d118739176e62
48+
# Note that the resource is specified to limit the token to Azure DevOps
49+
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
50+
Write-Host "##vso[task.setvariable variable=AzDO.OneLocBuildToken;issecret=true]${token}"
51+
3652
- task: OneLocBuild@2
3753
displayName: OneLocBuild
3854
env:
@@ -41,7 +57,7 @@ jobs:
4157
locProj: Localize/LocProject.json
4258
outDir: $(Build.StagingDirectory)
4359
packageSourceAuth: patAuth
44-
patVariable: $(OneLocBuild--PAT)
60+
patVariable: $(AzDO.OneLocBuildToken)
4561
isCreatePrSelected: true
4662
repoType: gitHub
4763
gitHubPatVariable: $(github--pat--vs-mobiletools-engineering-service2)

0 commit comments

Comments
 (0)