CAMPUX Cloud Bootcamp Phase Two · Class Thirteen
Phase Two — Core Infrastructure
Reading 46 min · Drills 6 · 3 Labs
Aligned to AZ-104
Class Thirteen

Load Balancing & Traffic

Four Azure services stand at the front door and send arriving traffic somewhere sensible — and telling them apart is really two questions: how far away do they work, and how much of the request can they read.

§1

Four doors, one decision

Picture a large venue on a busy night. Out on the motorway, long before you arrive, a road sign points you toward the nearest open site — it never sees your car, it only tells you where to go. At the site, a global entrance greets everyone, caches the cloakroom tickets so repeat visitors breeze through, and waves you to the nearest gate. Inside, an usher reads your ticket and sends you to the right section by what is printed on it. And at each section, a simple turnstile just counts bodies through whichever lane is free. Four different helpers, four different jobs — and Azure's traffic services map onto them almost exactly.

The four are Azure Load Balancer, Application Gateway, Front Door, and Traffic Manager. Newcomers memorise four separate product pages and stay confused. Professionals hold a single small grid, because every one of these answers the same two questions differently.

The grid
Two axes decide almost everything: scope — does it work globally, across regions, or only within one region — and layer — does it move packets blindly at Layer 4, or read the HTTP request at Layer 7?

Place the four on that grid and the confusion evaporates. Load Balancer is regional and Layer 4 — the turnstile. Application Gateway is regional and Layer 7 — the usher. Front Door is global and Layer 7 — the global entrance with the cloakroom cache. Traffic Manager is global but works at DNS, before any packet arrives — the motorway sign. Learn the grid, not the brochures, and picking the right one becomes a two-question decision rather than a memory test.

§2

Layer 4 and Layer 7, honestly

The layer axis is the one people fudge, so state it plainly. Layer 4 works at the level of TCP and UDP: it sees an incoming connection as an address and a port, and forwards it — fast, cheap, and utterly indifferent to what the traffic contains. Layer 7 works at the level of the HTTP request itself: it can read the URL path, the host header, the cookies, and decide where to send the request based on what it actually is.

Layer 4 — the turnstile
Distributes by connection, on IP and port. It cannot tell a request for /images from one for /checkout because it never looks. Blazingly fast, protocol-agnostic, no HTTP smarts.
Layer 7 — the usher
Reads the request. It can route /api to one pool and /images to another, terminate TLS, rewrite headers, and inspect content for attacks — at the cost of doing more work per request.

The consequence for design: if you need to route or protect traffic by what the request says — path-based routing, host-based routing, a web firewall — you need Layer 7, which means Application Gateway or Front Door. If you only need to spread raw connections across a set of machines and the content is irrelevant or not even HTTP, Layer 4 Load Balancer is the leaner tool. Reaching for Layer 7 when Layer 4 would do adds cost and latency for smarts you never use; reaching for Layer 4 when you needed to route by URL leaves you unable to do the one thing the job required.

§3

Application Gateway and the firewall that reads

Application Gateway is the regional Layer 7 option: it lives inside your VNet, in one region, and distributes HTTP traffic to backends there by path or host. Its most valuable feature is the one worth a section of its own — the Web Application Firewall.

WAF
A Web Application Firewall — rules that inspect the content of each HTTP request and block common web attacks, such as SQL injection and cross-site scripting, before they ever reach your application.

This is a different kind of fence from the NSG of Class Ten. An NSG decides whether a connection is allowed by address and port; it cannot see that an allowed request carries a malicious payload in its body. A WAF reads the request and recognises the attack itself — the injection string, the script tag — and refuses it. The two layer together: the NSG controls who may knock, the WAF inspects what they are carrying. Neither replaces the other.

Application Gateway with WAF is the right tool when the traffic is regional and internal — a line-of-business app served to staff, an admin console that never needs a global edge. It sits in the VNet, close to its backends, applying its rules in-region. For Campux that describes the internal admin application exactly, which is why the Gateway stays in the design even after the storefront moves to something bigger.

§4

Front Door: the global front door

For a public website, the modern default is Front Door. It is the global Layer 7 service: traffic enters at Microsoft's edge locations around the world — hundreds of them — and is routed to the nearest healthy backend region, with a content cache and a web firewall built in at that same edge.

Three things make it the standard choice for web today. It is global, so a visitor in another continent enters at an edge near them rather than crossing the planet to your region. It caches static content at the edge, so images and scripts are served close to the user and never trouble your origin — the CDN behaviour folded in. And it carries a WAF at the edge, so attacks are absorbed far from your application, along with the platform's DDoS protection.1 A request for a cached product image may be answered entirely at the edge, thousands of kilometres from the storefront, in a few milliseconds.

The distinction from Traffic Manager is the one interviews probe, so hold it precisely. Front Door is in the data path: traffic flows through it, so it can cache, inspect and route on content. Traffic Manager works at DNS: it answers the question "which address should this name resolve to" and then steps out of the way — it never sees the traffic, cannot cache, cannot inspect.2 Traffic Manager is the motorway sign; Front Door is the entrance you actually walk through. Choose Traffic Manager when you need DNS-level direction across endpoints of any protocol; choose Front Door when you want a global HTTP front door that does real work on the request.

§5

Health probes: the part everyone gets wrong

Every one of these services sends health probes to its backends and stops sending traffic to any that fail. This is the mechanism that turns a pool of machines into something resilient — and it is also the single most commonly misconfigured thing in the whole topic.

Health probe
A periodic request the load balancer makes to each backend to decide whether it is fit to receive traffic. Its worth depends entirely on whether the thing it checks reflects the thing that matters.

A probe that always says healthy is blind.

Here is the classic failure. A probe is pointed at the site's home page, or a bare / that returns a static "200 OK" no matter what — and it dutifully reports every instance healthy even while the application behind it cannot reach its database and is failing every real order. The load balancer, seeing green, keeps routing customers to a broken machine. The probe was answering "is the web server process running?" when the question that mattered was "can this instance actually serve a request?"

The fix is a probe that tells the truth: a dedicated health endpoint that checks the app's real dependencies — its database, its critical downstream services — and returns unhealthy when any of them is down, so the load balancer pulls the instance out before a customer hits it. Configure the probe to reflect readiness, not mere aliveness, and set the thresholds so a blip does not eject a healthy node nor a real failure linger. A load balancer is only as honest as its probe; a probe that cannot fail is a light that is painted green.

Table 1 — The decision, on one page
ServiceScopeLayerReach for it when
Load BalancerRegionalL4 (TCP/UDP)Spreading raw connections across VMs in a region
Application GatewayRegionalL7 (HTTP)In-region web routing and a WAF, inside the VNet
Front DoorGlobalL7 (HTTP)A global public website: edge caching, routing, WAF
Traffic ManagerGlobalDNSDNS-level direction across endpoints, any protocol
Case File · Campux Retail

Campux's front door, and its side door

Front Door for the storefront · Application Gateway for the admin app

The public storefront gets Front Door. Shoppers enter at the Microsoft edge nearest them; product images and scripts are cached there, so the App Service origin from Class Eleven is spared the repeated load and pages feel fast far from the region; and the edge WAF turns away the routine flood of injection and scripting attacks before they reach the app. For a seasonal retailer whose traffic is spiky and public, the global edge and the cache are worth exactly what they cost.

The internal admin application — used only by staff, never by the public — keeps an Application Gateway with WAF inside the VNet. It needs Layer 7 routing and a firewall, but not a global edge; a regional gateway close to its backends is the honest fit, and keeping it internal is part of its security.3 Campux uses no Traffic Manager: it runs in a single region, so there are no cross-region endpoints for a DNS-level director to choose between — a service not used on purpose, which is its own kind of design decision.

Both front doors probe their backends with real health endpoints, not a static page — because the one thing worse than an outage is a load balancer that cannot see it. Next class removes the public door from the parts that should never have had one.

Watch · Microsoft Learn

The official module, and a CAMPUX overview

Read or work the module first; watch the overview to see it move
Microsoft Learn · Modules

What is Azure Front Door? (docs)
learn.microsoft.com/azure/frontdoor/front-door-overview

The regional counterpart: What is Azure Load Balancer? (docs)
learn.microsoft.com/azure/load-balancer/load-balancer-overview

CAMPUX overview video

A short walkthrough of the scope-by-layer grid and a health probe that tells the truth will live here. Video to be added.

Lab 1 · Azure CLI

Put a global front door on a site the CLI way

~12 minutes · Azure Cloud Shell · needs a public origin host

You will stand up an Azure Front Door — profile, endpoint, origin group, origin, route — in front of a public web address. The origin group is where the health probe lives, so this lab is also where you configure the thing everyone gets wrong. Point the origin at the web app from the Class Eleven lab, or any site you own.

  1. Open Cloud Shell — the >_ icon in the top bar — and choose Bash. Set the origin host you will front:

    az group create --name rg-campux-lab --location westeurope
    ORIGIN=<your-app>.azurewebsites.net   # a public host you control
  2. Create the profile and a public endpoint:

    az afd profile create --resource-group rg-campux-lab \
      --profile-name fd-campux --sku Standard_AzureFrontDoor
    az afd endpoint create --resource-group rg-campux-lab \
      --profile-name fd-campux --endpoint-name campux --enabled-state Enabled
    On screen: the endpoint is a global entry name at Microsoft's edge — the front door itself. Nothing is routed anywhere yet; the next steps say where traffic goes and how health is judged.
  3. Create the origin group with the health probe — the honest one:

    az afd origin-group create --resource-group rg-campux-lab \
      --profile-name fd-campux --origin-group-name og-campux \
      --probe-request-type GET --probe-protocol Https \
      --probe-path /health --probe-interval-in-seconds 30 \
      --sample-size 4 --successful-samples-required 3 \
      --additional-latency-in-milliseconds 50
    The lesson: the probe path is /health, not / — a real readiness endpoint that fails when the app's dependencies fail, so Front Door pulls a broken origin before customers hit it. Probing the home page is how a dead instance keeps serving errors.
  4. Add the origin, then a route tying the endpoint to the origin group:

    az afd origin create --resource-group rg-campux-lab \
      --profile-name fd-campux --origin-group-name og-campux \
      --origin-name storefront --host-name $ORIGIN \
      --origin-host-header $ORIGIN --https-port 443 \
      --priority 1 --weight 1000 --enabled-state Enabled
    az afd route create --resource-group rg-campux-lab \
      --profile-name fd-campux --endpoint-name campux --route-name route \
      --origin-group og-campux --supported-protocols Https \
      --forwarding-protocol HttpsOnly --link-to-default-domain Enabled \
      --https-redirect Enabled
    On screen: browse the endpoint's *.azurefd.net hostname (from az afd endpoint show) and your origin answers through the global edge. Propagation takes a few minutes.
  5. Tear down (Front Door Standard bills while it exists):

    az group delete --name rg-campux-lab --yes --no-wait
Lab 2 · Azure Portal

Create a Front Door by hand

~12 minutes · the same front door, built so the create flow teaches you

Now build it by clicking. The quick-create flow bundles endpoint, origin, and route on one page — and the origin section is where the health probe is set. Use the same public origin host.

  1. Go to portal.azure.com and sign in.

  2. In the search bar at the top, type Front Door and CDN profiles, select it, then + Create and choose Quick create.On screen: Quick create asks for the tier (choose Standard), an endpoint name, and an origin — the three pieces you built one command at a time in Lab 1, now on a single form.

  3. Set Tier to Standard, name the profile and endpoint, and add the origin: origin type (App Services or Custom) and the public host name.On screen: choosing Standard folds in the CDN cache and a WAF option; Premium adds managed security rules. This is the modern default the class recommends for public web.

  4. Enable caching if offered, then Review + create and create.On screen: caching at the edge is what serves your images near the user without touching the origin — the behaviour that makes a global site feel fast far from its region.

  5. Once deployed, open the profile → Origin groups → your group → and find the health probe settings.On screen: confirm the probe path points at a real health endpoint, not the home page. This one field is the difference between detecting an outage and serving customers into one.

  6. Tear down: delete the resource group (or the Front Door profile).

Portal wording drifts; if a label here does not match your screen, the anchors are the Front Door and CDN profiles service, Quick create, and the Origin groups / health probe settings.

Lab 3 · Explore the front door

Read routing, caching, and the probe on the blades

~5 minutes · look, do not change — learn the service by its screens

Open the Front Door you built and let each blade confirm a fact from the class.

  1. Open the profile's Origin groups and read the health probe and load-balancing settings.On screen: probe path, interval, and the sample counts that decide healthy vs unhealthy. This is the blade the whole §5 is about — a probe pointed at a static page is the most common self-inflicted outage in the topic.

  2. Open Endpoints and the routes under them.On screen: which paths forward to which origin group, and the HTTPS-redirect and caching rules. This is Layer 7 at work — routing on the request, not just the connection.

  3. Open Security (or the associated WAF policy, if you added one).On screen: the web application firewall applied at the global edge — attacks turned away far from your origin. On Standard it is optional; on Premium it comes with managed rules.

On the job

The deploy that stopped meaning downtime

You · Cloud Engineer · one server is melting

A single instance is pegged at 100% while its twin sits idle, because nothing is spreading the traffic. You put a load balancer in front, health-probe the pool, and watch the graph flatten. Then you add a second instance and the app keeps serving straight through a node reboot — the first time a deploy stops meaning downtime for anyone.

Class Thirteen

Examination

Four drills, then two situations. The situations have no marking scheme — write your answer before you reveal the reasoning, or the exercise is worthless. Nothing is stored; this is between you and the page.

Drill 01Recall · pick the service
A public website needs a global entry point that caches static content near users, routes to the nearest healthy region, and blocks web attacks at the edge. Which service?
Marked

C. Global, edge caching, routing, and a WAF at the edge is the exact description of Front Door. A is regional and Layer 4 — no HTTP awareness, no caching. B is Layer 7 with a WAF but regional, so it gives no global edge or cache. D directs at DNS and never touches the traffic, so it cannot cache or inspect anything. When the words "global," "cache," and "web firewall" appear together, the answer is Front Door.

Drill 02Recall · pick the service
You need to distribute plain TCP connections across several virtual machines inside one region. The traffic is not HTTP and needs no content inspection. Which service is the leanest fit?
Marked

A. Raw TCP, one region, no HTTP smarts needed is Layer 4 — Azure Load Balancer, the turnstile. B and C are Layer 7 HTTP services; they would work for web traffic but are the wrong layer for arbitrary TCP and add cost and latency for inspection you do not need. D operates at DNS, not on connections at all. Choosing the leanest tool that does the job is the whole point of the grid: do not pay for Layer 7 when Layer 4 is what the traffic is.

Drill 03Select three
Which three are genuine capabilities of Azure Front Door?
Marked

Global edge routing, edge caching, and an edge WAF. Those are Front Door's defining three. The two wrong answers are other services in disguise: raw TCP/UDP balancing is Load Balancer's Layer 4 job — Front Door is HTTP/HTTPS only — and "purely at DNS, never in the data path" is the precise definition of Traffic Manager. Picking either reveals the confusion this class exists to end: Front Door is in the traffic; Traffic Manager only points at it.

Drill 04Spot the error
This health-probe configuration lets broken instances keep receiving customers. Which line is the cause?
Health probe — storefront backend pool

1.  Protocol:            HTTPS
2.  Path:                /   (static home page, returns 200 always)
3.  Interval:            30s, unhealthy after 3 failures
4.  Backend port:        443
Marked

Line two. Probing / — a static page that returns 200 regardless of whether the app can actually serve orders — means the probe reports healthy even when the instance's database is unreachable and every real request is failing. The probe measures "is the web server up," not "can this instance do its job," so the load balancer keeps routing customers to a machine that is silently broken. Lines one, three and four are reasonable.

Consider the consequence. During an incident where the database is down, customers keep being sent to dead instances and see errors, while every dashboard shows the backend "healthy" — the outage is invisible to the very system meant to detect it. The fix is a real health endpoint that checks dependencies and returns unhealthy when they fail. A probe that cannot report sick is a smoke detector with the battery removed.

Situation 01Write before you reveal
Support reports the storefront is "down." But it loads fine for you, and for most customers — the complaints all come from people on one particular ISP in one city. Walk through how you diagnose this.
"Down" is the wrong word already. What does "down for one ISP only" actually tell you?
Reasoning

Reject the premise first: this is not "down." A site that is down is down for everyone; a site that fails for one ISP in one city is a path problem, not an origin problem. The single most useful move is to stop trusting one vantage point — test from multiple locations and networks (your phone off wifi, an external checker, a colleague elsewhere) to draw the boundary of who is actually affected. The shape of the failure is the diagnosis.

Work the path from the user inward. With a global front door, traffic from that ISP enters at a nearby edge location — so suspect the leg between the user and the edge, or that specific edge, before your origin. Check DNS resolution on the affected network (are they getting the right address, is a stale or poisoned cache sending them wrong?), then whether the edge they land on is healthy, then peering or routing between that ISP and Microsoft's edge. Your origin serving everyone else fine is strong evidence the fault is out there, not in here.

Separate "our problem" from "their path," then act accordingly. If it is a bad edge or a routing issue, you gather evidence and escalate with specifics rather than thrashing your own healthy backend. If it is DNS TTL or a misconfiguration on your side that only some resolvers have picked up, that is yours to fix. Either way, the discipline is the same: measure the blast radius before you touch anything, because "down" was a word that would have sent you debugging the one thing that was working.

Situation 02Write before you reveal
A teammate proposes adding Traffic Manager in front of the storefront "to cache pages globally and make the site faster." Is that what Traffic Manager does? Correct the plan.
What layer does Traffic Manager work at, and can something at that layer cache anything?
Reasoning

Name the category error: Traffic Manager works at DNS, and DNS cannot cache pages. Traffic Manager answers "what address should this name resolve to" and then steps out of the path entirely — it never sees a single request, so it cannot cache content, inspect it, or accelerate it. The teammate has asked a DNS director to do a content-delivery job it is architecturally incapable of.

Point at the tool that actually does this. Global caching and acceleration for a website is Front Door's job — it sits in the data path at the edge, caches static content near users, and routes on the request. If the goal is "faster pages globally," Front Door is the answer, and it is very likely already the storefront's front door, so there may be nothing new to add at all.

Say where Traffic Manager would be right, so the correction teaches. Traffic Manager earns its place directing across endpoints of any protocol — for instance steering between two regions for disaster recovery, or across services Front Door does not front. It is a real tool for a real job; caching pages is simply not that job. Matching the service to the layer is the whole skill this class is training.

Examination record · first attempt
0/4
Class Thirteen · Complete
Retain this much

Five things worth carrying out of this class

  1. Two questions place every traffic service: what scope (global or regional) and what layer (L4 packets or L7 requests)?
  2. Layer 4 forwards connections blindly and fast; Layer 7 reads the HTTP request and can route, terminate TLS, and inspect it.
  3. Application Gateway is regional L7 with a WAF; Front Door is global L7 with edge caching and a WAF — the modern default for public web.
  4. Traffic Manager works at DNS: it points at endpoints and never touches the traffic, so it cannot cache or inspect anything.
  5. A health probe must reflect real readiness, not mere aliveness. A probe that cannot fail keeps sending customers to broken machines.
Notes
  1. Microsoft has consolidated its edge and content-delivery lineup over time — Front Door now comes in Standard and Premium forms that fold in the CDN and WAF capabilities, and older standalone CDN offerings are being retired. Learn the capability — global edge, caching, WAF, in the data path — rather than the exact SKU name, and check the current product page before you quote a tier or a feature boundary.
  2. Because Traffic Manager works through DNS, its failover is only as fast as DNS lets it be: clients and resolvers cache the answer for the record's time-to-live, so a failed endpoint can keep receiving traffic until those cached lookups expire. This is the structural reason Traffic Manager reacts in the tens of seconds to minutes, not instantly, and why a data-path service like Front Door fails over faster — it is in the traffic, not merely naming it.
  3. "Front Door for new projects" is the current industry lean, not a rule for every case. Application Gateway remains right when you specifically need a regional, in-VNet Layer 7 with a WAF and no global edge — the internal admin app here — and plenty of sound designs run both, Front Door at the global edge routing to regional gateways. Default to Front Door for public web; justify the alternatives by the constraint that calls for them.