Deploying an application to the cloud is an important part of the software development lifecycle. Developers typically write application code, build the project, run tests, package the output, and deploy it to a hosting environment.
When working with Azure App Service and GitHub, GitHub Actions is commonly used to automate this process. However, creating a deployment pipeline manually requires knowledge of YAML configuration, build commands, authentication, deployment actions, and environment settings.
For developers who want to get started quickly, Azure App Service provides an integrated deployment experience through Deployment Center.
Instead of creating a GitHub Actions workflow from scratch, developers can connect their GitHub repository and allow Azure to generate the required workflow configuration.
This approach reduces initial setup work while retaining the flexibility of GitHub Actions for future customization.
In this article, we will explore how to deploy a GitHub repository to Azure App Service without manually building a CI/CD pipeline, understand the generated workflow, configure secure authentication, and troubleshoot common deployment problems.
Understanding GitHub and Azure App Service Integration
Azure App Service is a managed hosting platform for running web applications and APIs.
It supports applications built with technologies such as:
- ASP.NET Core
- Node.js
- Java
- Python
- PHP
GitHub provides source control and GitHub Actions for automating software development workflows.
When these services are connected, developers can push application changes to GitHub and automatically trigger a deployment to Azure App Service.
The integration uses GitHub Actions as the deployment automation engine, while Azure helps configure the connection and generate the workflow.
How the Deployment Process Works
The overall deployment process follows a straightforward sequence.
- A developer pushes application changes to GitHub.
- GitHub detects the repository update.
- The configured GitHub Actions workflow starts.
- The workflow prepares the build environment.
- The application is compiled and packaged.
- The generated deployment steps publish the application to Azure App Service.
- Azure App Service starts or updates the application.
The architecture looks like this:
Developer
|
v
Git Push
|
v
GitHub Repository
|
v
GitHub Actions
|
v
Build Application
|
v
Run Tests
|
v
Deploy to Azure
|
v
Azure App Service
|
v
Running Application
The important point is that developers do not need to write the initial workflow manually. Azure generates the workflow file and commits it to the selected repository.
Understanding Deployment Center
Deployment Center is available inside the Azure App Service resource.
It provides an interface for connecting source repositories and configuring continuous deployment.
For GitHub integration, Deployment Center can:
- Connect a GitHub organization.
- Select a repository.
- Select a deployment branch.
- Generate a GitHub Actions workflow.
- Configure authentication.
- Add the required GitHub repository secrets.
- Display deployment workflow information.
The generated workflow is stored in the repository under:
.github/workflows/
This is important because the workflow belongs to the GitHub repository. It is not an independent deployment process that runs entirely inside the Azure portal.
Developers can inspect and modify the generated YAML whenever the deployment requirements change.
Prerequisites
Before configuring the deployment, ensure that you have:
- An active Azure subscription.
- An Azure App Service web application.
- A GitHub account.
- A GitHub repository containing the application source code.
- Permission to authorize Azure to access the repository.
- Sufficient Azure permissions to configure the App Service deployment connection.
For an existing application, the App Service should have a compatible operating system and runtime configuration.
For example, an ASP.NET Core application should use an App Service runtime compatible with the application's target framework.
Deploying a GitHub Repository Without Creating a Workflow Manually
Let's consider an ASP.NET Core Web API that is already available in a GitHub repository.
Our objective is to deploy this application to Azure App Service whenever changes are pushed to the main branch.
Step 1: Open Azure App Service
Sign in to the Azure portal.
Navigate to App Services and select the application where you want to deploy the GitHub repository.
If you do not already have an App Service, create one using the required operating system, runtime stack, and hosting plan.
After opening the application, locate Deployment Center in the left navigation menu.
Step 2: Select GitHub as the Deployment Source
Inside Deployment Center, open the Settings section.
Select GitHub as the source provider.
Azure may ask you to authorize access to your GitHub account.
Complete the authorization process using the GitHub account that has sufficient access to the target repository.
After authorization, Azure can retrieve the available organizations and repositories.
Step 3: Select the Repository and Branch
Choose the required GitHub organization, repository, and branch.
For example:
| Setting | Example value |
|---|
| Source | GitHub |
| Organization | MyOrganization |
| Repository | CustomerApi |
| Branch | main |
| Build provider | GitHub Actions |
Selecting the correct branch is important because it determines which source code triggers the deployment.
For production applications, avoid deploying every development branch directly to the live environment.
A dedicated release branch or protected production branch provides better control.
Step 4: Configure Authentication
Azure App Service supports different authentication options for GitHub Actions deployments.
For new configurations, OpenID Connect (OIDC) using a user-assigned managed identity is the recommended approach.
With this approach, GitHub Actions obtains a short-lived identity token and exchanges it with Microsoft Entra ID to access the required Azure resources.
This avoids storing a permanent Azure client secret or App Service publish profile in GitHub.
The available authentication methods include:
| Authentication method | Description | Recommendation |
|---|
| OpenID Connect | Uses federated identity and short-lived tokens | Recommended |
| Publish profile | Uses App Service publishing credentials | Legacy alternative |
| Service principal | Uses application credentials | Use only when appropriately secured |
For OIDC authentication, Azure configures the required federated identity relationship and GitHub repository secrets.
Your Azure account needs sufficient permissions to create or configure the managed identity and its role assignment.
If you do not have those permissions, an Azure administrator can configure the identity and assign the required access.
Step 5: Save the Configuration
After selecting the repository, branch, and authentication method, save the Deployment Center configuration.
Azure generates a GitHub Actions workflow based on the application stack and deployment settings.
The workflow is committed to the repository under:
.github/
workflows/
main_customerapi.yml
The actual filename is generated by the deployment configuration.
At this point, you have not manually written the pipeline YAML.
Azure has prepared the initial deployment workflow and connected it to your repository.
Step 6: Verify the Generated Workflow
Open your GitHub repository.
Navigate to the Actions tab and locate the workflow generated by Azure.
The workflow generally contains the following responsibilities:
- Checking out the repository.
- Preparing the required build environment.
- Installing the application dependencies.
- Building or publishing the application.
- Authenticating with Azure.
- Deploying the application to App Service.
For example, a generated .NET workflow may contain a build-and-publish operation similar to:
- name: Build and publish
run: dotnet publish -c Release -o ./publish
The exact generated YAML depends on the application stack and deployment configuration.
Review the workflow before relying on it for production deployment.
The ability to inspect the generated file is important because automated configuration should not be treated as a replacement for understanding the deployment process.
Step 7: Trigger the First Deployment
Make a small application change and push it to the selected branch.
For example:
git add .
git commit -m "Update application"
git push origin main
GitHub Actions detects the repository update and starts the configured workflow.
Open the Actions tab to monitor the execution.
You can also open Deployment Center in Azure and review the deployment logs.
If the workflow completes successfully, open the App Service URL and verify that the application is responding correctly.
Understanding What Happens After Deployment
Connecting GitHub to Azure App Service does not mean every deployment is automatically production-ready.
The generated workflow handles the configured build and deployment tasks, but developers remain responsible for application quality and deployment safety.
For example, an ASP.NET Core application may build successfully but still fail at runtime because of:
- Missing application settings.
- Incorrect connection strings.
- Database connectivity problems.
- Unsupported runtime configuration.
- Missing environment variables.
- Incorrect startup configuration.
Therefore, successful workflow execution should be followed by application-level verification.
For production applications, consider adding automated tests, deployment health checks, and a rollback strategy.
Best Practices for Production Deployments
Use OpenID Connect Authentication
Prefer OIDC with a user-assigned managed identity instead of storing long-lived publishing credentials.
It reduces the need to manage permanent secrets and provides a more secure authentication model.
Protect the Deployment Branch
Use GitHub branch protection rules to prevent unreviewed changes from reaching production.
Require pull request reviews and successful status checks before merging into the production branch.
Review Generated YAML
Azure generates the initial workflow, but developers should understand its triggers, build commands, authentication configuration, and deployment steps.
Customize it when additional validation or deployment requirements exist.
Separate Development and Production Environments
Avoid using the same App Service environment for every deployment stage.
Separate development, staging, and production environments help reduce accidental production changes.
Configure Application Settings Separately
Do not place production connection strings, API keys, or passwords inside the GitHub repository.
Use Azure App Service configuration, managed identity, and Azure Key Vault where appropriate.
Add Health Checks
Verify that the application is operational after deployment.
For ASP.NET Core applications, implement a health endpoint and configure monitoring to detect failures after a new release.
Advantages and Disadvantages
Advantages:
- No need to manually create the initial GitHub Actions YAML.
- Faster integration between GitHub and Azure App Service.
- Automatically generates deployment configuration.
- Supports OpenID Connect authentication.
- Provides deployment monitoring through GitHub Actions and Deployment Center.
- Allows developers to customize the generated workflow later.
- Supports multiple application technology stacks.
Disadvantages:
- Generated workflows may not cover every custom deployment requirement.
- Developers still need to understand the generated configuration.
- Advanced release strategies require additional workflow customization.
- Azure permissions are required to configure identity and deployment access.
- Incorrect branch selection can trigger unintended deployments.
- Successful deployment does not guarantee application health.
Common Mistakes and Troubleshooting
| Problem | Possible cause | Recommended solution |
|---|
| GitHub repository is not visible | GitHub authorization is incomplete | Reauthorize the correct GitHub account |
| Workflow is not generated | Deployment Center configuration was not saved successfully | Review repository permissions and configuration |
| Azure authentication fails | Incorrect federated identity configuration | Verify the managed identity and GitHub OIDC settings |
| Build fails | Incorrect runtime or SDK configuration | Check the project target framework and build environment |
| Deployment succeeds but application fails | Missing runtime settings or configuration | Review App Service logs and application settings |
| New commits do not trigger deployment | Incorrect branch or workflow trigger | Review the generated YAML |
| Production deployment happens unexpectedly | Unprotected deployment branch | Configure branch protection and environment approvals |
Summary
Deploying a GitHub repository to Azure App Service does not require developers to build an entire GitHub Actions pipeline manually.
Azure App Service provides Deployment Center, which connects GitHub repositories, configures authentication, and generates the initial GitHub Actions workflow automatically.
Developers can select the organization, repository, and branch, configure secure authentication, and allow Azure to prepare the deployment workflow.
For production environments, OpenID Connect with a user-assigned managed identity is the recommended authentication approach because it avoids storing long-lived publishing credentials.
However, automatically generated workflows still require review and testing. Teams should protect deployment branches, validate application configuration, monitor application health, and introduce additional deployment controls when needed.
By using Deployment Center, developers can reduce the initial CI/CD setup effort and focus more on application development while retaining control over how their applications are built, tested, and deployed.
Join the conversation! Your thoughts help the community grow.