Azure Application Gateway - Complete Guide

What is Azure Application Gateway?

Azure Application Gateway is a **layer 7 (HTTP/HTTPS) load balancer** that manages traffic to web applications. It offers **intelligent routing, SSL termination, Web Application Firewall (WAF), and autoscaling**.

Key Features

  • Load Balancing: Distributes traffic across multiple backends.
  • URL-based Routing: Routes requests based on URLs.
  • SSL Termination: Offloads SSL processing.
  • Web Application Firewall (WAF): Protects against attacks.
  • Autoscaling: Adjusts capacity automatically.

Creating an Application Gateway

Step 1: Create a Resource Group

az group create --name MyResourceGroup --location eastus

Step 2: Create a Virtual Network

az network vnet create --name MyVnet --resource-group MyResourceGroup --subnet-name MySubnet

Step 3: Create an Application Gateway

az network application-gateway create --name MyAppGateway --resource-group MyResourceGroup --vnet-name MyVnet --subnet MySubnet --capacity 2 --sku WAF_v2

Configuring Backend Pools

Backend pools define the destination for traffic.

az network application-gateway address-pool create --gateway-name MyAppGateway --resource-group MyResourceGroup --name BackendPool --servers 10.0.0.4 10.0.0.5

Configuring Listeners and Routing

Step 1: Create a Listener

az network application-gateway http-listener create --gateway-name MyAppGateway --resource-group MyResourceGroup --name MyListener --frontend-port 80

Step 2: Create Routing Rule

az network application-gateway rule create --gateway-name MyAppGateway --resource-group MyResourceGroup --name MyRule --http-listener MyListener --rule-type Basic --address-pool BackendPool

Enabling Web Application Firewall (WAF)

az network application-gateway waf-config set --gateway-name MyAppGateway --resource-group MyResourceGroup --enabled true --firewall-mode Detection

Monitoring Application Gateway

Check Logs

az monitor diagnostic-settings show --name AppGatewayLogs --resource MyResourceGroup

Conclusion

Azure Application Gateway helps improve performance, security, and scalability for web applications.

📌 Next Topic: Azure Traffic Manager