Skip to content

[release/8.0] Use WIF-based Entra auth for OneLocBuild ceapex feed access#17086

Open
missymessa wants to merge 2 commits into
release/8.0from
onelocbuild-wif-migration-8.0
Open

[release/8.0] Use WIF-based Entra auth for OneLocBuild ceapex feed access#17086
missymessa wants to merge 2 commits into
release/8.0from
onelocbuild-wif-migration-8.0

Conversation

@missymessa

Copy link
Copy Markdown
Member

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

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
Copilot AI review requested due to automatic review settings July 8, 2026 20:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CeapexServiceConnection parameter intended to switch ceapex feed auth from PAT to Entra token acquisition.
  • Introduces an AzureCLI@2 step to acquire an Azure DevOps resource token and passes it into OneLocBuild@3 via patVariable.
  • Duplicates these changes across both eng/common/templates/job/ and eng/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 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants