Introduction
Deploying applications manually can be time-consuming and error-prone. In modern development, Continuous Integration and Continuous Deployment (CI/CD) help automate the build, test, and deployment process.
Using GitHub Actions with Azure App Service, you can automatically deploy your .NET 9 application whenever you push code to your repository.
In this guide, you will learn how to set up a complete CI/CD pipeline for a .NET 9 application using GitHub Actions in a simple and practical way.
What is CI/CD?
CI/CD stands for:
Continuous Integration (CI): Automatically build and test your code
Continuous Deployment (CD): Automatically deploy your application
In simple words:
"Push code → Automatically build → Automatically deploy"
Why Use GitHub Actions for .NET Deployment?
Built into GitHub (no extra tools needed)
Easy YAML-based configuration
Seamless integration with Azure
Supports automation workflows
Prerequisites
Before starting, ensure you have:
Azure account
GitHub repository with your .NET 9 app
Azure App Service created
Step 1: Create Azure App Service
Go to Azure Portal
Create a Web App
Choose .NET runtime
Save:
App Name
Publish Profile
Step 2: Download Publish Profile
From Azure Portal:
Go to your App Service
Click "Get publish profile"
This file contains deployment credentials.
Step 3: Add Secrets in GitHub
Go to your GitHub repository:
Settings → Secrets → Actions
Add a new secret:
Name: AZURE_WEBAPP_PUBLISH_PROFILE
Value: Paste publish profile content
Step 4: Create GitHub Actions Workflow
Create a file:
.github/workflows/deploy.yml
Add the following configuration:
name: Deploy .NET 9 App to Azure
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --configuration Release
- name: Publish project
run: dotnet publish -c Release -o publish
- name: Deploy to Azure
uses: azure/webapps-deploy@v2
with:
app-name: YOUR_APP_NAME
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: publish

Join the conversation! Your thoughts help the community grow.