In the previous tutorial, we deployed:
- π§± Azure Kubernetes Service
- π‘ Azure Application Gateway (WAF_v2)
- π AGIC (Application Gateway Ingress Controller)
- π Exposed nginx via Kubernetes Ingress
That architecture looked like this:
User β Application Gateway β AKS β Pods
This works great for regional workloads.
But what if you want:
- π Global routing
- β‘ Latency optimization
- π Automatic regional failover
- π‘ Edge TLS termination
- π SaaS-grade architecture
Thatβs where Azure Front Door comes in.
π Target Architecture
We are extending the previous lab into this:
Global Users
β
Azure Front Door (Global Edge)
β
Application Gateway (Regional WAF)
β
AKS (via AGIC)
β
Pods
Now:
- Front Door handles global entry
- App Gateway handles regional WAF
- AGIC dynamically manages routing to Kubernetes services
This is a production SaaS pattern.
π Step 1 β Assumptions
You already completed the AGIC lab and have:
- Resource Group
- VNet
- AKS cluster
- Application Gateway
- Public IP for App Gateway
- Working nginx ingress
You can verify:
curl http://<APPGW_PUBLIC_IP>
You should see the nginx welcome page.
π Step 2 β Create Azure Front Door
Weβll now add Azure Front Door in front of Application Gateway.
Create Front Door Profile
AFD_PROFILE="afd-agic-demo"
AFD_ENDPOINT="afd-endpoint"
az afd profile create \
--resource-group $RG \
--profile-name $AFD_PROFILE \
--sku Standard_AzureFrontDoor
Create Endpoint
az afd endpoint create \
--resource-group $RG \
--profile-name $AFD_PROFILE \
--endpoint-name $AFD_ENDPOINT
This gives us a global Anycast hostname like:
https://afd-endpoint-xxxxx.z01.azurefd.net
π Step 3 β Create Origin Group
Now we define where Front Door should send traffic.
AFD_ORIGIN_GROUP="origin-group-appgw"
az afd origin-group create \
--resource-group $RG \
--profile-name $AFD_PROFILE \
--origin-group-name $AFD_ORIGIN_GROUP \
--probe-request-type GET \
--probe-protocol Http \
--probe-interval-in-seconds 30 \
--probe-path "/" \
--sample-size 4 \
--successful-samples-required 3 \
--additional-latency-in-milliseconds 0
Health probes ensure automatic failover later if needed.
π Step 4 β Add Application Gateway as Origin
We use the App Gateway Public IP as backend.
APPGW_IP=$(az network public-ip show \
--resource-group $RG \
--name appgw-pip \
--query ipAddress \
--output tsv)
az afd origin create \
--resource-group $RG \
--profile-name $AFD_PROFILE \
--origin-group-name $AFD_ORIGIN_GROUP \
--origin-name origin-appgw \
--host-name $APPGW_IP \
--http-port 80 \
--https-port 443 \
--origin-host-header $APPGW_IP \
--priority 1 \
--weight 1000
Now Front Door knows where to route traffic.
π Step 5 β Create Routing Rule
az afd route create \
--resource-group $RG \
--profile-name $AFD_PROFILE \
--endpoint-name $AFD_ENDPOINT \
--route-name route-all \
--origin-group $AFD_ORIGIN_GROUP \
--supported-protocols Http Https \
--forwarding-protocol HttpOnly \
--https-redirect Enabled \
--link-to-default-domain Enabled
This connects:
Front Door β Origin Group β Application Gateway
π§ͺ Step 6 β Test Global Entry
Get hostname:
az afd endpoint show \
--resource-group $RG \
--profile-name $AFD_PROFILE \
--endpoint-name $AFD_ENDPOINT \
--query hostName -o tsv
Test:
curl https://<AFD_HOSTNAME>
You should see:
curl -L -s http://afd-endpoint-dxd8bebma8dbdsed.z01.azurefd.net/ | grep -i "welcome"
<title>Welcome to nginx!</title>
<h1>Welcome to nginx!</h1>
Now traffic flow is:
User β Front Door β App Gateway β AKS β nginx Pod
π§ What Just Changed?
Before:
Internet β Application Gateway β AKS
After:
Internet β Azure Front Door β Application Gateway β AKS
π₯ Why This Matters
| Feature | App Gateway Only | With Front Door |
|---|---|---|
| Global Anycast | β | β |
| Multi-region routing | β | β |
| Edge TLS | β | β |
| Global failover | β | β |
| CDN caching | β | β |
You just transformed a regional ingress into a global SaaS architecture.
π’ Real-World SaaS Pattern
Large platforms use this layering:
- Azure Front Door (global entry)
- Regional WAF (Application Gateway)
- Kubernetes ingress (AGIC)
- Microservices
Benefits:
- Defense in depth
- Separation of concerns
- Independent scaling
- Enterprise security posture
π‘ Optional Next Steps
To take this further:
- Add a second region and origin for active-active routing
- Enable Front Door WAF
- Use custom domain + managed TLS
- Make App Gateway private and use Private Link
- Add blue/green weighted routing
π§Ή Cleanup
az group delete --name $RG --yes
π― Final Thoughts
By adding Azure Front Door in front of AGIC:
You moved from a regional demo
to a production-grade global SaaS architecture.
This pattern is ideal for:
- Multi-region APIs
- AI inference endpoints
- E-commerce platforms
- Enterprise SaaS

Top comments (0)