This content originally appeared on DEV Community and was authored by Abisola Adesegun
Deploying a web app with a CI/CD pipeline on Azure App Service involves several steps, from creating the web app to setting up the CI/CD pipeline. Here’s a detailed guide:
Prerequisites
Azure Account: Ensure you have an active Azure subscription.
Source Code Repository: Your web app’s source code should be in a Git repository (e.g., GitHub, Azure Repos, Bitbucket).
Visual Studio Code: Install VSC for command-line operations.
CI/CD Tool: You can use tools like GitHub Actions, Azure Pipelines, or any other CI/CD service.
Create an Azure App Service
Login to Azure Portal:
Go to the Azure Portal.
Sign in with your Azure account.
Create the Web App Plan:
- In the Azure Portal, search for “App Services plan” and click “Create.”
Create or select an existing Resource group
Provide a name for the app service plan
Select Operating system and region
- Click “Review + create,” then “Create.”
Create the Web App:
- In the Azure Portal, search for “App Services” and click “Create.”
Select the resource group created earlier.
Provide a name for the app service, which will be the domain name (.azurewebsites.net).
Choose a runtime stack (e.g., .NET, Node.js, Python).
Select the region and a pricing plan.
- Click “Review + create,” then “Create.”
Configure the CI/CD Pipeline
Using GitHub Actions:
Connect Azure App Service to GitHub:
Navigate to your App Service in the Azure Portal.
In the left-hand menu, select “Deployment Center.”
Under “Source,” select “GitHub.”
Authenticate with your GitHub account.
- Choose the repository and branch you want to deploy.
Set Up Your Local Development Environment:
- Initialize Git from Visual studio code terminal:
- Create a directory
- Enter into directory
- Clone the directory
- Enter into the file
- Touch the file eith index.php
- Nano into the file using nano index.php
- let use simple expression
echo “Hello world” which is an output
- save and enter
- Read the output of the file using the followig commans
git add .
then git commit
Then push
Result
Click Browse to read the output
Edit the output message and push again
- Add
- Commit
- Push
- Result
- Browse
Conclusion
You now have a web app deployed on Azure App Service with a CI/CD pipeline configured. This setup ensures that every time you push code changes, your web app is automatically tested and deployed, ensuring faster and more reliable updates.
This content originally appeared on DEV Community and was authored by Abisola Adesegun