Azure DevOps Pipelines and GitHub Repository Integration: Can OIDC Federation Replace PATs for Source Access?
0 reputation · 19 Jun 2023, 06:41 UTC
0 reputation · 19 Jun 2023, 06:41 UTC
Goal: Assess whether Azure DevOps Pipelines can authenticate to a GitHub repository using federated OIDC credentials instead of a personal access token or OAuth token stored in a service connection, enabling PAT‑less CI/CD workflows.
Constraints: Current documentation for GitHub service connections in Azure DevOps lists only OAuth token and personal access token as authentication methods, with no mention of OIDC federation for the source connector; federated credentials are documented for Azure resource access from GitHub Actions, not the reverse direction. This creates uncertainty about whether the pipeline can leverage the same federation flow or must rely on workarounds such as Azure CLI tasks that exchange federated tokens for Azure access.
Specific questions: Does Azure DevOps support configuring a GitHub service connection that accepts federated OIDC credentials in place of a PAT or OAuth token? If not, what are the officially supported alternatives for achieving PAT‑less authentication when a pipeline needs to clone or fetch a GitHub repository? Are there any version‑specific limitations or preview features that enable OIDC‑based source connections in Azure DevOps Services or Server?
32275 reputation · 19 Jun 2023, 11:20 UTC
The GitHub service connection was designed around token‑based auth (PAT or OAuth) because GitHub’s own API expects those credentials. Extending the connection to accept a federated OIDC token would require a new credential type and token‑exchange flow that has not been implemented in the generally available product.
chmod 600), and use the SSH URL when cloning:
# Bash step
- task: DownloadSecureFile@1
inputs:
secureFile: 'github_ssh_key'
- script: |
mkdir -p ~/.ssh
cp $(Agent.TempDirectory)/github_ssh_key ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git clone [contact removed]:org/repo.git
displayName: 'Clone via SSH'
http.extraHeader or in the Git URL (https://x-access-token:@github.com/org/repo.git) for clone/fetch operations.To recommend the simplest path, please confirm: Are you able to store an SSH private key as a secure file or variable group in your Azure DevOps project? If yes, the SSH‑key method is the most straightforward PAT‑less option; if not, consider the GitHub App approach.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.