Setting up CI/CD pipelines to automatically deploy your app to Azure App Service not only saves time but also ensures smoother, faster, and more reliable releases. In this guide, you’ll learn how to:
• Deploy a web app to Azure App Service
• Connect it to GitHub for CI/CD
• Enable automatic deployment on commit
Table of Contents
- Prerequisites
- Step 1: Create a Web App Service Plan on Azure
- Step 2: Create a Web App Service on Azure
- Step 3: Add a PHP File in VS Code
- Step 4: Create a Repository on GitHub
- Step 5: Push Your Code to GitHub
- Step 6: Configure CI/CD from GitHub
- Making Future Changes
- Conclusion
Prerequisites
Before you start, make sure you have the following:
• An Azure account
• A GitHub account
• Git installed locally
• A simple web app (php.)
Step 1: Create a web App service plan on Azure
- Go to the Azure Portal
- Search for Web Services Plan
- Click + Create
- Fill in the required fields: o Resource Group: chose or create a resource group o Name: Your preferred name o Operating system: Linux o Region: Closest to your users o Pricing plan: chose your preferred plan
- Click Review + Create and then Create
Step 2: Create a web App service on Azure
- Go to the Azure Portal
- Search for Web Services
- Under create drop down, select web app
- Fill in the required fields:
- Resource Group: chose or create a resource group
- Name: Your preferred name
- Runtime Stack: Choose your tech (e.G php)
- Region: Closest to your users
- Operating system: Linux
- Click Review + Create and then Create
Once successfully created, go resource, copy the domain default link and open on a new web page. The web will be running waiting for your content deployment.
Step 3: add a php file on your vs code
- Open your vs code
- Add a folder
- Create a file name (e.g index.php)
- Copy the code and paste inside the idex.php file created.
- Save.
Step4: Create a Repository on Git hub
- Create a new Repo
- Fill in the repo
- Create
Step 5: Push your code to Github
- Git init
- git add index.php
- git commit -m "first commit"
- git branch -M master
- git remote add origin https://github.com/Ebukaeze16/ebuka-web-ap.git
- git push -u origin main
- check your github to confirm if it was successfully pushed
Step 6: Configure CI/CD from GitHub
- Go to your Azure App services (ebuka-web-a)
- On the left panel, go to deployment center
- In the source dropdown menu, select Github
- Authorize and choose: a. Organization b. Repository
- After authorization, proceed to select your Github information like your account name, repo name and branch and then save
6.Once complete, on the overview page, copy the default domain URL and paste on a web page to view the deployed app running.
- On the Github portal, you can see it running on the action tab
8.To make any changes, you can go to vs code, on the php file add your change and do the following;
a. Git add . (this add all the file)
b. Git commit -m “add your comment”
c. Git pull origin master
d. Git push origin master
e. Git push
From the Azure portal and Github portal, you can also see the new update made.
Conclusion
You’ve now:
• Created an Azure Web App
• Connected GitHub to deploy automatically
• Triggered a CI/CD deployment with a simple push
• Did file modification and push again
This setup makes it super easy to keep your live website in sync with your GitHub repository. Automate your deployments and focus on what matters most — building great apps.
Top comments (0)