Migrating CI/CD from Azure DevOps to GitHub Actions with Azure OIDC and ACR
Introduction As part of learning and preparing for a migration from Azure DevOps pipelines to GitHub Actions , I decided to build a small practice project before working with a real application. Project repository: github url The goal for this exercise was straightforward: Build a Go application, create a GitHub Actions pipeline, authenticate securely to Azure, build a Docker image, and push it to Azure Container Registry (ACR). For this exercise, I deliberately stopped at ACR . Kubernetes and AKS deployment will come later. What I wanted to achieve The goal was to build a workflow that could: Run when a Pull Request is created Build and test the Go application Build a Docker image Authenticate to Azure without using a client secret Push the image to Azure Container Registry The final flow looks like this: Pull Request ↓ GitHub Actions ↓ Go Build & Test ↓ Docker Build ↓ GitHub OIDC ↓ Microsoft Entra ID ↓ Azure Container Registry ↓ Docker Image 1. The Practice Project I used a small Go REST API project for the exercise. The application itself wasn't the main focus. I mainly needed a working application that could: Build successfully with Go Run inside Docker Expose an HTTP endpoint I verified the application locally with: go run . Then tested its health endpoint: curl http://localhost:10000/health-check which returned: { "healthy" : true } I also built the Docker image locally: docker build -t go-rest-api:1.0 . and verified that the container worked: docker run --rm -p 10000:10000 go-rest-api:1.0 At this point, I knew the application and Dockerfile were working. 2. Creating the GitHub Actions Pipeline I created the workflow file: .github/workflows/ci-cd.yml The initial pipeline was intentionally simple. name : Go CI/CD on : pull_request : jobs : build : runs-on : ubuntu-latest steps : - name : Checkout code uses : actions/checkout@v4 - name : Set up Go uses : actions/setup-go@v5 with : go-version : ' 1.27' - name : Download dependencies run : go mod download - name :