Lab 09: Implement Web Apps
I’m Amir Rouhanipoor, an IT Consultant specializing in Azure and cloud solutions. I help organizations streamline their IT and drive growth through secure, efficient cloud technologies.
Search for a command to run...
I’m Amir Rouhanipoor, an IT Consultant specializing in Azure and cloud solutions. I help organizations streamline their IT and drive growth through secure, efficient cloud technologies.
No comments yet. Be the first to comment.
Objective: This lab demonstrates how to deploy and test a containerized web application using Azure Container Instances (ACI). Scenario: Your organization is evaluating Azure Container Instances as a solution for deploying a web application to the cl...
PowerShell Script for VM Size Comparison This script lists all session hosts with their host pool, VM name, and VM size across all host pools(loop through multiple resource groups): Connect-AzAccount # Get all host pools $hostPools = Get-AzWvdHostPo...
M03 - Unit 4: Configure an ExpressRoute Gateway Exercise Scenario To connect your Azure virtual network to your on-premises network using ExpressRoute, you must first create a virtual network gateway. A virtual network gateway serves two key purposes...
M02-Unit 3 Create and configure a virtual network gateway Scenario You will configure a VPN gateway to securely connect CoreServicesVnet (East US) and ManufacturingVnet (North Europe) using VNet-to-VNet VPN. Task 1: Create CoreServicesVnet and Manuf...
Introduction Azure ExpressRoute is a private, enterprise-grade connection that enables secure and reliable network connectivity between your on-premises infrastructure and Microsoft’s global network. It bypasses the public internet and provides high ...
You need to create three virtual networks: 1. CoreServicesVnet Region: East US Purpose: Main network (web services, databases, shared services like DC/DNS). Connectivity: Needs VPN connection to on-premises. Address Space: Large (because of expe...
Security-focused Cloud & Automation Engineer with a Master’s in Computer Science and 6+ years of experience automating and supporting enterprise IT environments across multi-site corporate and operational infrastructures. Proficient in Python scripting, Azure infrastructure, Windows Server, and identity management. Skilled in integrating third-party platforms, securing configurations, and streamlining operations. Currently pursuing the Cybersecurity Architect Expert certification with a strong focus on cloud security and automation.
Objective: This lab introduces Azure Web Apps. You'll create a web app, deploy a simple "Hello World" application from GitHub, configure a staging slot, swap slots, and configure autoscaling.
Scenario: Your organization is migrating on-premises websites to Azure. You'll explore using Azure Web Apps (part of Azure App Service) to host a PHP-based website, replacing aging on-premises hardware.
Key Concepts:
Azure Web Apps: A fully managed platform-as-a-service (PaaS) for hosting web applications. Supports various languages and frameworks (e.g., .NET, PHP, Node.js, Java, Python).
App Service Plan: Defines the compute resources (VM size, number of instances) allocated to your web app. Determines pricing and scaling capabilities.
Deployment Slots: Separate environments (e.g., staging, production) within a single web app. Allow you to test changes before deploying them to production.
Deployment Center: Manages deployments to your web app, supporting various sources like GitHub, Azure Repos, and local Git.
Autoscaling: Automatically adjusts the number of instances in your App Service plan based on demand (e.g., CPU usage).
Swapping Slots: A zero-downtime deployment technique. Traffic is redirected from one slot (e.g., staging) to another (e.g., production) with minimal interruption.
Lab Tasks
Sign In: Log in to the Azure portal (https://portal.azure.com).
Create Web App: Search for and select "App Services" and click "+ Create" -> "Web App."
Basics:
Name: WebApp48965394 (or a unique name) - This will be part of your web app's URL.
Publish: Code
Runtime stack: PHP 8.2
Operating System: Linux
Pricing plan: Premium V3 P1v3 (This is important for autoscaling later)
Zone Redundancy: accept the defaults.
Click "Review + create," then "Create."

Add Staging Slot:
In your web app's resource, under "Deployment," select "Deployment slots."
Click "Add slot."
Name: staging
Clone settings from: Do not clone settings
Click "Add."
Verify Staging Slot URL: Click on the newly created staging slot. Note that it has a different URL than the production slot (it will include -staging in the name).

Deployment Center (Staging Slot):
Important: Make sure you are on the staging slot's blade (not the production slot). You can verify by checking the URL or the name at the top of the blade.
Under "Deployment," select "Deployment Center."
Settings:
Source: External Git
Repository: https://github.com/Azure-Samples/php-docs-hello-world
Branch: master
Click "Save."

Test Staging Slot:
Go to the "Overview" blade of the staging slot.
Click the "Default domain" link. You should see the "Hello World" application. This may take a minute or two to deploy; refresh the page if needed.
Swap Slots:
Navigate back to the main web app's resource (not the staging slot). The easiest way is to use the breadcrumbs at the top of the portal.
Under "Deployment," select "Deployment slots."
Click "Swap."
Verify that the Source is staging and the Target is production.
Click "Start Swap."

Test Production Slot:
Go to the "Overview" blade of the main web app (not the staging slot).
Click the "Default domain" link. You should now see the "Hello World" application on the productionURL. The swap is complete.
Copy the default domain URL - you will need it for load testing.
Configure Autoscaling:
Go to the main web app's resource (not the staging slot).
Under "Settings," select "Scale out (App Service plan)."
Choose Automatic. Note the Rules Based option.
Set the maximum burst field to 2 and cliock on save. ("maximum burst" refers to the maximum number of instances that an App Service Plan can scale out to during periods of high demand.)


Create a Load Test:
In the left pane, select Diagnose and solve problems.
In the "Load Test your App" box, select "Create Load Test."
Click "+ Create" and give your load test a unique name.
Select Review + create and then Create.
Wait for the test to be created, select Go to resource.

Add HTTP Request to Load Test
From the Overview | Add HTTP requests, select Create.
On the "Test plan" tab, click "Add request."
In the "URL" field, paste your "Default domain" URL (from Task 4, Step 2). Ensure it begins with https://.
Click "Review + create," then "Create." (This may take a couple of minutes.)

Observe Test Results (Briefly):
Review the test results, looking at "Virtual users," "Response time," and "Requests/sec."
Click "Stop" to end the test. You don't need to wait for the full test to complete for the purposes of this lab. The goal is to initiate a load test, not to fully analyze its results.
