---
title: "What is the best way to set up CI/CD for ASP.NET Core apps targeting Azure App Service using GitHub Actions?"  
description: "What is the best way to set up CI/CD for ASP.NET Core apps targeting Azure App Service using GitHub Actions?"  
author: "Austin Luthar"  
published: 2026-09-17  
canonical: https://answers.mindstick.com/qa/117209/what-is-the-best-way-to-set-up-ci-cd-for-asp-net-core-apps-targeting-azure-app-service-using-github-actions  
category: "DevOps"  
tags: ["DevOps", "GitHub Actions", "deployment"]  
reading_time: 2 minutes  

---

# What is the best way to set up CI/CD for ASP.NET Core apps targeting Azure App Service using GitHub Actions?

## Automating Deployments to App Service

Manual zip-and-drop deployments do not scale. A GitHub Actions workflow can build, test, and push your ASP.NET Core project straight to an [Azure App Service](https://answers.mindstick.com/qa/117161/how-to-authenticate-aspnet-core-web-apis-using-azure-app-service-authentication-easy-auth) slot, giving you zero-downtime releases.

### Workflow Structure

The pipeline needs an Azure login action, a build step that restores NuGet packages and runs your test suite, and a deployment action targeting the correct slot. Environment variables for connection strings should live in the repository secrets, not the workflow file.

```yaml
# .github/workflows/deploy.yml
name: Deploy to Azure App Service

on:
  push:
    branches: [ main ]

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      # Authenticate against Azure using a service principal stored in secrets.
      - name: Azure Login
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}

      # Restore dependencies and build the web project.
      - name: Setup .NET
        uses: actions/setup-dotnet@v3
        with:
          dotnet-version: '8.0.x'
      - run: dotnet restore
      - run: dotnet build --no-restore

      # Publish the app and slot it into the staging environment.
      - name: Deploy to App Service
        uses: Azure/webapps-deploy@v3
        with:
          app-name: 'my-aspnet-app'
          slot-name: 'staging'
          package: 'publish/my-aspnet-app.zip'
```

Always promote the staging slot to production only after health checks pass. Skipping this step means a broken build can instantly replace live traffic.


---

Original Source: https://answers.mindstick.com/qa/117209/what-is-the-best-way-to-set-up-ci-cd-for-asp-net-core-apps-targeting-azure-app-service-using-github-actions

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
