Azure Pipelines with GitHub Source Code
1. What is it?
Yes. Azure Pipelines can build source code stored in GitHub.
Your source code does not need to be stored in Azure Repos to use Azure Pipelines.
A common setup is:
GitHub
│
│ Source Code
↓
Azure Pipelines
│
├── Restore
├── Build
├── Test
└── Publish
This is important because source control and CI/CD can come from different platforms.
2. Simple Syntax / Sample
Suppose your ASP.NET Core application is stored in GitHub:
https://github.com/mycompany/myapp
You can place an azure-pipelines.yml file in the GitHub repository:
trigger:
branches:
include:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '8.x'
- script: dotnet restore
displayName: 'Restore'
- script: dotnet build --configuration Release
displayName: 'Build'
- script: dotnet test --configuration Release
displayName: 'Test'
Azure Pipelines connects to the GitHub repository and uses this YAML definition.
3. Detailed Explanation
Suppose your application is hosted in GitHub:
GitHub Repository
│
├── src/
├── tests/
├── MyApp.sln
└── azure-pipelines.yml
You then configure an Azure Pipeline to use that GitHub repository.
Step 1 — Connect Azure DevOps to GitHub
In Azure DevOps:
Azure DevOps
↓
Pipelines
↓
New Pipeline
↓
Select GitHub
↓
Select Repository
Azure DevOps must be authorized to access the appropriate GitHub repository.
Step 2 — Developer pushes code
For example:
git add .
git commit -m "Add login feature"
git push origin main
The code is pushed to:
GitHub
not Azure Repos.
Step 3 — GitHub change triggers Azure Pipeline
The configured integration allows the repository event to cause Azure Pipelines to evaluate/run the pipeline.
Developer
↓
git push
↓
GitHub Repository
↓
Configured Trigger
↓
Azure Pipeline
Step 4 — Azure Pipeline gets the GitHub source
An Azure Pipelines agent checks out the source code from GitHub.
GitHub
│
│ Checkout source
↓
Azure Pipelines Agent
The agent then executes the pipeline.
For example:
Checkout
↓
dotnet restore
↓
dotnet build
↓
dotnet test
↓
Publish Artifact
Step 5 — Pipeline reports the result
For example:
GitHub
↓
Azure Pipeline
↓
Build ✓
Tests ✓
↓
Pipeline Success
The pipeline can subsequently be used as part of a deployment workflow to environments such as Azure App Service, VMs, containers, or Kubernetes.
4. GitHub + Azure Pipelines vs Azure Repos + Azure Pipelines
| Source Repository | CI/CD | Possible? |
|---|---|---|
| GitHub | GitHub Actions | Yes |
| GitHub | Azure Pipelines | Yes |
| Azure Repos | Azure Pipelines | Yes |
| Azure Repos | Other supported CI systems | Depends on the CI system/integration |
The important concept is:
Source Control ≠ CI/CD Tool
You can choose them separately.
For example:
Option 1
GitHub
↓
GitHub Actions
or:
Option 2
GitHub
↓
Azure Pipelines
or:
Option 3
Azure Repos
↓
Azure Pipipelines
5. Practical Team Scenario
Your organization might already have all its repositories in GitHub:
GitHub
├── CustomerAPI
├── OrderAPI
└── PaymentAPI
But the organization may use Azure DevOps for CI/CD.
There is no requirement to migrate those repositories to Azure Repos simply for that reason.
The architecture can remain:
GitHub
│
│ Source Code
↓
Azure Pipelines
│
├── Build
├── Unit Test
├── Package
└── Publish
↓
Deployment stages
↓
Dev → SIT → UAT → Production
6. Key Points
- Yes, Azure Pipelines supports GitHub repositories.
- GitHub can remain your source-code repository.
- Azure Pipelines can provide the CI/CD pipeline.
- Azure DevOps must be authorized to access the GitHub repository.
- An
azure-pipelines.ymlfile can define the pipeline. - A GitHub push or Pull Request can be configured to trigger Azure Pipelines.
- The Azure Pipelines agent checks out the source code from GitHub and builds/tests it.
- You do not need Azure Repos just because you are using Azure Pipelines.
- GitHub Actions is another CI/CD option when your source is in GitHub.
A useful interview relationship is:
GitHub / Azure Repos
↓
Source Control
Azure Pipelines / GitHub Actions
↓
CI/CD
7. Interview Answer
Yes. Azure Pipelines can build source code stored in GitHub. We can connect an Azure DevOps pipeline to a GitHub repository and authorize Azure DevOps to access it. When a configured event such as a push or Pull Request occurs in GitHub, Azure Pipelines can automatically check out the source code, restore dependencies, build the application, run tests, and publish artifacts. Therefore, we can use GitHub for source control while using Azure Pipelines for CI/CD; using Azure Pipelines does not require the source code to be stored in Azure Repos.