DEV Community

1suleyman
1suleyman

Posted on

Implementing Web Apps in Azure: AZ-104 Lab 09a Review

Introduction

As part of my journey to becoming an Azure Administrator, I recently completed Lab 09a - Implement Web Apps from the AZ-104 certification series. This lab provided hands-on experience in creating, configuring, and scaling Azure Web Apps.
I learned to deploy a Hello World application from GitHub, use deployment slots for staging and production environments, and configure autoscaling to meet demand. This post documents my key takeaways, insights, and the tasks I completed in this lab.

Lab Overview

This lab focused on leveraging Azure App Services to host web applications and scale them efficiently. The primary objective was to create a web app using PHP, deploy it from an external GitHub repository, configure deployment slots, swap them, and finally set up autoscaling to accommodate fluctuating traffic. By completing this lab, I gained a deeper understanding of deploying and managing web apps in Azure.

Skills Practiced:

✅ Creating and configuring Azure Web Apps
✅ Using deployment slots for staging and production
✅ Deploying web apps from an external GitHub repository
✅ Swapping deployment slots between staging and production
✅ Configuring and testing autoscaling

Task 1: Create and Configure an Azure Web App

The first task involved creating an Azure Web App using the Azure portal. Here's what I did:

1️⃣ Signed into the Azure portal – Azure Portal.

2️⃣ Navigated to App Services and created a new Web App with the following settings:
Runtime stack: PHP 8.2
Operating System: Linux
Region: East US
Pricing plan: Premium V3 P1V3

3️⃣ After the Web App was created, I verified the default web page in the browser.

📌 Insight:
Azure Web Apps (part of Azure App Services) provide a fully managed platform for building and hosting applications in various runtimes like PHP, .NET, and Java. It's a great solution for deploying web applications without the need to manage underlying infrastructure.

Task 2: Create and Configure a Deployment Slot

Next, I created a staging deployment slot to test my app before moving it to production. Here's what I did:

1️⃣ From the Deployment slots section of the Web App, I added a new slot named "staging."

2️⃣ I chose not to clone settings, ensuring a fresh configuration for testing purposes.

3️⃣ Once the slot was created, I verified that the staging slot had a unique URL, different from the production slot.

📌 Insight:
Deployment slots in Azure allow you to create isolated environments for testing new versions of your app without affecting the production version. After testing, you can easily swap slots to promote the changes to production.

Task 3: Configure Web App Deployment Settings

In this task, I configured the deployment settings to enable continuous deployment from GitHub. Here’s what I did:

1️⃣ In the Staging slot, I navigated to the Deployment Center and selected External Git as the source.

2️⃣ I entered the GitHub repository URL (https://github.com/Azure-Samples/php-docs-hello-world) and selected the master branch.

3️⃣ I saved the settings and visited the staging slot's URL, where the Hello World application from GitHub was successfully deployed.

📌 Insight:
Continuous deployment ensures that your web app is always up-to-date with the latest code changes. By integrating GitHub with Azure Web Apps, you can automate the deployment process and streamline the development lifecycle.

Task 4: Swap Deployment Slots

The next step involved swapping the staging slot with the production slot to promote the tested changes to the live environment. Here’s what I did:

1️⃣ From the Deployment slots section, I selected Swap to move the staging slot to production.

2️⃣ I verified that the production slot displayed the Hello World application after the swap was completed.

📌 Insight:

Swapping deployment slots is a critical operation for ensuring smooth updates in production environments. It minimizes downtime and allows for quick rollback if necessary.

Task 5: Configure and Test Autoscaling of the Azure Web App

In the final task, I configured autoscaling to handle increased traffic and ensure optimal performance. Here's what I did:

1️⃣ Navigated to the Scale out section of the App Service plan for the production slot.

2️⃣ Set up automatic scaling based on metrics like CPU usage. I configured a maximum burst of 2 instances.

3️⃣ I then created a load test to simulate increased traffic to the app and verified that the autoscaling rules triggered correctly.

📌 Insight:
Autoscaling helps ensure that your web app can handle changes in traffic while minimizing costs. By scaling out during high demand and scaling in when traffic decreases, Azure Web Apps can maintain performance and efficiency.

Key Learnings

1️⃣ Azure Web Apps
Azure Web Apps provide a fully managed platform to host web applications in various programming languages, offering high availability, security, and scalability.

2️⃣ Deployment Slots
Deployment slots are essential for safe app deployment. By using staging slots, you can test changes before pushing them to production, reducing the risk of errors or downtime.

3️⃣ Continuous Deployment with GitHub
Integrating GitHub with Azure Web Apps enables continuous deployment, which ensures that the latest version of the app is always running, improving development efficiency.

4️⃣ Autoscaling
Autoscaling allows web apps to automatically adjust resources based on traffic, ensuring optimal performance without over-provisioning resources, and thus optimizing costs.

Conclusion

Completing this lab enhanced my understanding of Azure Web Apps and their management features. I learned how to deploy and configure web apps, use deployment slots for safe testing and production promotion, and set up autoscaling to handle changing traffic loads. Azure Web Apps offers a powerful platform for hosting scalable web applications, and the tools for deployment and scaling make it easier to manage apps in production environments.

🚀 Stay tuned for my next blog post on Lab 09b - Implement Azure Container Instances!

🔗 Follow my journey as I continue mastering Azure Administration! 🚀

Top comments (0)