user-guides

Azure Front Door – Best Practices, Configuration, Caching, and Logging

This document summarizes recommended practices, configuration steps, sample scripts, and links to official Microsoft documentation for deploying Azure Front Door.


1. Overview

Azure Front Door (AFD) is a scalable and secure entry point for fast delivery of your global web applications. It combines load balancing, intelligent routing, WAF, and application acceleration via caching.

References:


2. General Best Practices

2.1 Choose the Right Global Load Balancer

More details:
Microsoft Best Practices
Well-Architected AFD Guide


3. Security & TLS

Example portal steps:

  1. Go to Front Door profile → “Frontend/domains” → Add custom domain.
  2. Under “Routing rules”, enable “Redirect HTTP to HTTPS”.
  3. Under “Security”, set minimum TLS version.
  4. Attach or create WAF policy.

Reference:
Microsoft AFD Security Best Practices


4. Caching Best Practices

Sample: Azure CLI for purge

az network front-door purge-endpoint \
  --resource-group <RG> \
  --front-door-name <FDName> \
  --content-paths "/images/*"

Reference:
How to Avoid Caching Woes with Microsoft Azure Front Door


5. Logging and Monitoring

Sample: Enable Diagnostic Logging via Azure CLI

az monitor diagnostic-settings create \
  --resource <FrontDoorResourceId> \
  --workspace <LogAnalyticsWorkspaceId> \
  --logs '[{"category":"FrontdoorAccessLog","enabled":true},{"category":"FrontdoorWebApplicationFirewallLog","enabled":true}]'

6. Standard Practices/Architecture


7. Example Step-by-Step: Minimal Setup

a. Create Front Door (Portal Steps)

  1. Create resource → Azure Front Door (Standard/Premium)
  2. Add frontend/domains: Provide custom domain, enable HTTPS.
  3. Add backend pools: Add web apps, VMs, or APIs as backends.
    • Set “backend host type” accordingly.
    • Secure origins; allow only AFD via Private Link or IP header rule.
  4. Create routing rules: Define matching paths and origin pools.
    • Enable caching if needed.
  5. Enable diagnostic logging/WAF.

b. Sample ARM Snippet for Caching Rule

{
  "properties": {
    "cachingEnabled": true,
    "cacheDuration": "P1D",
    "queryParameters": "*"
  }
}

(Add to routingRules properties in ARM template)


8. Additional References


9. Summary

  1. Use AFD in front for acceleration, security, and global scaling.
  2. Always secure origins; block direct traffic.
  3. Set explicit caching headers.
  4. Enable logs/diagnostics for visibility and tuning.
  5. Use ARM/Bicep for infra-as-code deployments.
  6. Reference Microsoft best practices regularly as features evolve.