[release/8.0] Use WIF-based Entra auth for OneLocBuild ceapex feed access#17086
Open
missymessa wants to merge 2 commits into
Open
[release/8.0] Use WIF-based Entra auth for OneLocBuild ceapex feed access#17086missymessa wants to merge 2 commits into
missymessa wants to merge 2 commits into
Conversation
Apply to release/8.0 (both templates-official and templates paths). Replace PAT-based authentication with Entra token acquired via AzureCLI@2 and the dnceng-onelocbuild-ceapex service connection. Related: AzDO#10151
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the OneLocBuild job templates to support accessing ceapex feeds using a WIF-based Entra token (acquired via AzureCLI@2) instead of a stored PAT, and applies the change to both the legacy templates/ and templates-official/ paths used by release/8.0.
Changes:
- Adds a
CeapexServiceConnectionparameter intended to switch ceapex feed auth from PAT to Entra token acquisition. - Introduces an
AzureCLI@2step to acquire an Azure DevOps resource token and passes it intoOneLocBuild@3viapatVariable. - Duplicates these changes across both
eng/common/templates/job/andeng/common/templates-official/job/.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| eng/common/templates/job/onelocbuild.yml | Adds service-connection-driven Entra token acquisition and wires token into OneLocBuild feed auth. |
| eng/common/templates-official/job/onelocbuild.yml | Mirrors the same auth + token acquisition changes for the official template path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+11
to
+14
| # Service connection for WIF-based Entra authentication to ceapex feeds (replaces CeapexPat). | ||
| # When set, uses AzureCLI@2 to obtain an Entra token instead of a PAT. | ||
| # Set to '' to fall back to PAT-based auth via CeapexPat parameter. | ||
| CeapexServiceConnection: 'dnceng-onelocbuild-ceapex' |
Comment on lines
+73
to
+85
| # Acquire Entra token for ceapex feed access when using WIF-based auth | ||
| - ${{ if ne(parameters.CeapexServiceConnection, '') }}: | ||
| - task: AzureCLI@2 | ||
| displayName: 'Acquire Entra token for ceapex feed access' | ||
| inputs: | ||
| azureSubscription: ${{ parameters.CeapexServiceConnection }} | ||
| scriptType: 'pscore' | ||
| scriptLocation: 'inlineScript' | ||
| inlineScript: | | ||
| $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv | ||
| if (-not $token) { Write-Error "Failed to acquire AzDO token"; exit 1 } | ||
| Write-Host "##vso[task.setvariable variable=CeapexEntraToken;issecret=true]${token}" | ||
| condition: ${{ parameters.condition }} |
Comment on lines
+11
to
+14
| # Service connection for WIF-based Entra authentication to ceapex feeds (replaces CeapexPat). | ||
| # When set, uses AzureCLI@2 to obtain an Entra token instead of a PAT. | ||
| # Set to '' to fall back to PAT-based auth via CeapexPat parameter. | ||
| CeapexServiceConnection: 'dnceng-onelocbuild-ceapex' |
Comment on lines
+76
to
+88
| # Acquire Entra token for ceapex feed access when using WIF-based auth | ||
| - ${{ if ne(parameters.CeapexServiceConnection, '') }}: | ||
| - task: AzureCLI@2 | ||
| displayName: 'Acquire Entra token for ceapex feed access' | ||
| inputs: | ||
| azureSubscription: ${{ parameters.CeapexServiceConnection }} | ||
| scriptType: 'pscore' | ||
| scriptLocation: 'inlineScript' | ||
| inlineScript: | | ||
| $token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv | ||
| if (-not $token) { Write-Error "Failed to acquire AzDO token"; exit 1 } | ||
| Write-Host "##vso[task.setvariable variable=CeapexEntraToken;issecret=true]${token}" | ||
| condition: ${{ parameters.condition }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #17083 to release/8.0.
Replaces PAT-based authentication for OneLocBuild's ceapex feed access with WIF-based Entra token via AzureCLI@2 and the dnceng-onelocbuild-ceapex service connection.
Note: release/8.0 uses the older dual-path template structure, so this updates both templates-official/ and templates/ paths.
Related: AzDO#10151