INTODUCTION
Deploying a web application from a GitHub repository to an Azure Web App (PaaS) involves several steps. Here’s a comprehensive guide to help you through the process:
Scenario: Let's walk through a specific scenario where you have a web application hosted in a GitHub repository, and you want to deploy this application to an Azure Web App using continuous deployment with GitHub Actions. In this project i will be using PHP and source code from my GitHub repository.
Steps Required:
Step 1: Create App Service Plan:
For demo purpose we'll be using a free app service plan that will run our web applications. Search for and select "App Service plans" in the search bar
Click on "+ Create" to create a new app service plan.
Project Details
Select your subscription, create a new resource group by clicking on "Create new"
App Service Plan details
Enter your app service plan a name, select the region close to your users.
Select the Pricing Tier of your choice and Click "Review + Create" then "Create"
Step 2: Create the Azure Web App
Next we need to create our web application using Azure App Service. Search for and Click on "App Services**"**
Select "+ Create" then "Web App"
Project Details
Select your Azure subscription and the previous resource group we created for our App Service Plan.
Instance Details
Enter a unique name for your web app, select PHP 8.2 "Runtime stack" and Choose the "Region" closest to your users.
Pricing plans
Select the previous App Service plan we create, then Click "Review + create" then "Create" to deploy the web application.
Wait for the deployment to complete, then Click "Go to resource". Next Click on "Default domain" link to view the default web application
The default web application will look like this
Step 3: Configure Deployment from GitHub
In the left-hand menu, click on "Deployment" then "Deployment Center".
Set Up Continuous Deployment:
Source: Select "GitHub".
GitHub Authorization: Authorize Azure to access your GitHub account.
Organization: Select your GitHub account or organization.
Repository: Select your repository
azure-web-app-demo
.Branch: Select the branch you want to deploy from, such as
main
.
Leave other parameters and click "Save" at the top of the page.
Make Changes to Your Code, Commit and push your changes to the main
branch.
In the left-hand menu, click on "Overview" then Click on the "Default domain" to view the new custom web application from GitHub we just integrated using CI/CD.
NOTE
The source code for this project can be downloaded from my GitHub Repository https://github.com/blessador/azure-web-app-demo
This project shows how to deploy a web application from a GitHub repository to an Azure Web App for continuous deployment. This setup ensures that every push to your repository's main branch automatically triggers a deployment, keeping your web app up-to-date with the latest code changes.