Azure Container Apps allows you to use GitHub Actions to publish revisions to your Container App. As commits are pushed to your GitHub repository, a GitHub Action is triggered which updates the container image in the container registry. Once the container is updated in the registry, Azure Container Apps creates a new revision based on the updated container image.
Until now we have worked with docker images that others have created, now we are going to do a code change on our own code base and push the changes to Container Apps using GitHub Actions. We are now going to use a Azure CLI command to create a GitHub Action that builds the Queue Reader C# project and pushes the image to Azure Container Registry and deploys it to our Container App.
The following image illustrates the steps in this challenge
- Configure CI/CD deployment of a Container App using GitHub actions
- Make a code change and deploy new version of Container App
- Verify changes after deployment
- Create a Microsoft Entra ID service principal with contributor permissions on your resource group
- Create a Personal Access Token (PAT) in GitHub with permissions to your repository and GitHub actions
- Add a GitHub Actions workflow to your repository to deploy a container app
- Do a code change in Queue Reader app and push changes to GitHub repository
- Add a new order using HTTP API
- Verify that the code change has been deployed by looking in Log Analytics
- Created a Microsoft Entra ID service principal and assigned it contributor access on your resource group
- Created a Personal Access Token (PAT) in GitHub with repo and workflows permissions
- Created a GitHub Actions workflow in your repository to deploy a container app
- Changed the C# code in Queue Reader app to write a custom log message
- Pushed the changes to your GitHub repo
- Verified that the new version of your Queue Reader app was successfully deployed
- Added an order by doing a HTTP POST to Http API (https://httpapi.[your container app environment domain]/data?message=[your message])
- Verified logs in Log Analytics for Queue Reader application that the new Queue Reader Container App is logging with your custom log message
- Publish revisions with GitHub Actions in Azure Container Apps (learn.microsoft.com)
- az containerapp github-action (learn.microsoft.com)
- Monitor logs in Azure Container Apps with Log Analytics (learn.microsoft.com)
- View the solution here: Challenge 5 - Solution
- Challenge 1: Setup the environment
- Challenge 2: Deploy Container Apps Environment and troubleshoot Container Apps
- Challenge 3: Split traffic for controlled rollout
- Challenge 4: Scale Container Apps
- Challenge 5: Configure CI/CD for Container Apps
- Challenge 6: Protect Container App with API Management
- Challenge 7: Enable Container App authentication