Updated 14/04/2026
“Azure Front Door is a modern cloud content delivery network (CDN) service that delivers high performance, scalability, and secure user experiences for your content and applications.” - https://azure.microsoft.com/en-us/products/frontdoor
This post captures the Terraform setup I am using for Azure Front Door (Standard) in front of an Azure Container App, with custom domain + managed TLS.
Overview
The goal is to expose the app on demo.it.com through Front Door and force HTTPS everywhere:
- Front Door profile SKU:
Standard_AzureFrontDoor - Origin: Container App ingress FQDN
- Custom domain TLS:
ManagedCertificate(minimumTLS12) - Routing:
/*withHttpsOnlyforwarding and HTTP -> HTTPS redirect
Reference Terraform: https://github.com/carlpaton/deploying-dotnet-azure/blob/main/iac_example/front-door.tf
Architecture
1 | Internet |
Terraform Resources
The configuration creates:
azurerm_cdn_frontdoor_profile(demo-afd)azurerm_cdn_frontdoor_endpoint(demo-afd-ep)azurerm_cdn_frontdoor_origin_group(demo-afd-og)azurerm_cdn_frontdoor_origin(demo-afd-origin)azurerm_cdn_frontdoor_custom_domain(demo-afd-cd)azurerm_cdn_frontdoor_route(demo-afd-route)azurerm_cdn_frontdoor_custom_domain_association(demo-afd-cda)- Outputs:
afd_endpoint_hostnameafd_custom_domain_validation_token
Key Configuration Details
Front Door Profile
sku_name = "Standard_AzureFrontDoor"response_timeout_seconds = 120
Origin Group
session_affinity_enabled = falserestore_traffic_time_to_healed_or_new_endpoint_in_minutes = 10
Health probe:
interval_in_seconds = 100path = "/"protocol = "Https"request_type = "HEAD"
Load balancing:
additional_latency_in_milliseconds = 0sample_size = 4successful_samples_required = 3
Origin (Container App)
host_name = azurerm_container_app.demo-aca.ingress[0].fqdnorigin_host_header = azurerm_container_app.demo-aca.ingress[0].fqdncertificate_name_check_enabled = truehttp_port = 80https_port = 443priority = 1weight = 1000
Custom Domain + TLS
host_name = "demo.it.com"certificate_type = "ManagedCertificate"minimum_tls_version = "TLS12"
Route
forwarding_protocol = "HttpsOnly"https_redirect_enabled = truepatterns_to_match = ["/*"]supported_protocols = ["Http", "Https"]link_to_default_domain = false
Prerequisites
- The Container App exists and has external ingress enabled.
- You can manage public DNS for the domain (for me: GoDaddy).
- Terraform is authenticated to Azure and targeting the correct subscription.
Deploy
1 | cd iac_example |
After apply:
- Front Door endpoint is created.
- Front Door returns the custom-domain validation token.
- You add DNS records.
- Managed cert is issued once validation succeeds.
DNS Records (GoDaddy)
Create these records after terraform apply:
| Type | Name | Value |
|---|---|---|
| TXT | _dnsauth.demo |
terraform output -raw afd_custom_domain_validation_token |
| CNAME | demo |
terraform output -raw afd_endpoint_hostname |
Get output values:
1 | terraform output -raw afd_endpoint_hostname |
DNS Validation Checks
Check authoritative first (source of truth):
1 | nslookup -type=CNAME demo.it.com ns23.domaincontrol.com |
Then check public resolver propagation:
1 | nslookup -type=CNAME demo.it.com 1.1.1.1 |
If authoritative looks correct but public resolvers do not, wait for propagation and retry.
Useful References
- https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/how-to-add-custom-domain
- https://learn.microsoft.com/en-us/azure/frontdoor/origin?pivots=front-door-standard-premium
- https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cdn_frontdoor_profile
- https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cdn_frontdoor_origin_group
- https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cdn_frontdoor_origin
- https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cdn_frontdoor_custom_domain
- https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cdn_frontdoor_route