Symptoms
- Browsers show
NET::ERR_CERT_DATE_INVALIDor "Your connection is not private" onwww.contoso.com. API clients fail withcertificate has expiredorThe remote certificate is invalid. - The
*.azurefd.netendpoint hostname still works. Only the custom domain fails. - The portal shows the domain as Pending revalidation, Rejected, Timeout or Approved with a certificate that has already expired.
1. Confirm what is being served (2 minutes)
echo | openssl s_client -connect www.contoso.com:443 -servername www.contoso.com 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates
The notAfter date and the issuer tell you a lot: an issuer from DigiCert's or Microsoft's managed chain means an AFD-managed certificate; your own CA means a customer certificate from Key Vault.
Then check the domain in Front Door:
az afd custom-domain list -g rg-edge --profile-name afd-prod \
--query "[].{name:name, host:hostName, validation:domainValidationState, certType:tlsSettings.certificateType, secret:tlsSettings.secret.id}" -o table
| Validation state / cert type | Meaning | Go to |
|---|---|---|
ManagedCertificate, PendingRevalidation | Managed cert couldn't auto-renew | Step 2 |
ManagedCertificate, Rejected | The certificate authority refused issuance (often a CAA record) | Step 2 |
CustomerCertificate | Front Door is using an old Key Vault version, or the Key Vault cert itself expired | Step 3 |
2. Managed certificate didn't renew
Front Door renews managed certificates on its own only when the domain's CNAME points directly at the Front Door endpoint (<endpoint>.z01.azurefd.net). If DNS goes through Traffic Manager, another CDN, a third-party proxy, or the domain is an apex using an alias record, Front Door asks you to revalidate ownership instead. Renewal starts around 45 days before expiry, so this state has usually been visible for weeks.
Check DNS:
dig +short CNAME www.contoso.com
dig +short CAA contoso.com
If a CAA record exists, it must allow digicert.com, or issuance is rejected. Add it in your DNS zone:
az network dns record-set caa add-record -g rg-dns -z contoso.com -n @ --flags 0 --tag issue --value digicert.com
Regenerate the validation token and publish the TXT record:
az afd custom-domain regenerate-validation-token -g rg-edge --profile-name afd-prod --custom-domain-name www-contoso-com
az afd custom-domain show -g rg-edge --profile-name afd-prod --custom-domain-name www-contoso-com \
--query "{state:domainValidationState, token:validationProperties.validationToken, expires:validationProperties.expirationDate}" -o json
az network dns record-set txt add-record -g rg-dns -z contoso.com -n _dnsauth.www --value "<token>"
If an old _dnsauth TXT value is still there, replace it rather than adding a second value. Validation fails until the old record's TTL has expired.
Validation and edge deployment take time. Microsoft's guidance allows for hours, and edge rollout of a new certificate can take longer in some regions. If users can't wait, use step 4.
Note
Microsoft has been changing how its managed TLS certificates are validated and issued, following CA and browser requirements. If revalidation keeps failing, check the current "Managed TLS changes" notice on Microsoft Learn for Front Door-specific requirements.
3. Customer certificate from Key Vault
Find the secret Front Door uses and whether it follows the latest version:
az afd secret list -g rg-edge --profile-name afd-prod \
--query "[].{name:name, source:parameters.secretSource.id, version:parameters.secretVersion, latest:parameters.useLatestVersion}" -o table
Check the certificate in Key Vault:
az keyvault certificate show --vault-name kv-edge-prod -n www-contoso-com \
--query "{expires:attributes.expires, enabled:attributes.enabled, version:id}" -o json
az keyvault certificate list-versions --vault-name kv-edge-prod -n www-contoso-com \
--query "[].{v:id, expires:attributes.expires, enabled:attributes.enabled}" -o table
| Finding | Fix |
|---|---|
| Newest Key Vault version is also expired | Renew or import a new certificate into Key Vault first |
| New version exists, Front Door pins an old one | Point the secret at the latest version (below) |
useLatestVersion is true but the old cert is still served | Front Door lost access to Key Vault, or rollout is still in progress |
Switch the secret to the latest version:
az afd secret update -g rg-edge --profile-name afd-prod --secret-name www-contoso-com-cert --use-latest-version true
If access was lost, check that Front Door's identity can still read the vault: the role assignment (Key Vault Secrets User and Key Vault Certificate User for RBAC vaults) or access policy (secret get, certificate get) for the Front Door service principal or managed identity, and the vault's firewall settings. The activity log on the vault shows recent role and network changes.
Front Door picks up a new Key Vault version on its own when it follows the latest version, but global rollout can take up to about 72 hours. Updating the secret forces it to re-read the certificate.
4. Emergency: get a valid certificate in front of users now
If revalidation is stuck, put a certificate you control on the domain:
- Get a certificate for the hostname from your CA (or reuse a valid wildcard you already have) and import it:
az keyvault certificate import --vault-name kv-edge-prod -n www-contoso-com-emergency -f www-contoso-com.pfx --password "<pfx-password>"
- Create a Front Door secret and switch the domain to it:
kv_id=$(az keyvault show -n kv-edge-prod --query id -o tsv)
az afd secret create -g rg-edge --profile-name afd-prod --secret-name www-contoso-com-emergency \
--secret-source "$kv_id/secrets/www-contoso-com-emergency" --use-latest-version true
az afd custom-domain update -g rg-edge --profile-name afd-prod --custom-domain-name www-contoso-com \
--certificate-type CustomerCertificate --secret www-contoso-com-emergency
The secret source is the ARM resource ID of the Key Vault secret that backs the certificate, without a version. Check az afd secret create --help for your CLI version, or add it in the portal under Secrets > Add certificate if the CLI rejects it. Front Door must be able to read the vault (see step 3) before the secret validates.
Warning
Make sure the PFX includes the full chain and the hostname is in the SAN list. A certificate with a missing intermediate works in some browsers and fails in mobile apps and API clients.
Verify recovery
openssl s_clientfrom step 1 shows the newnotAfterdate. Test from several networks; edge locations update at different times.az afd custom-domain listshowsApprovedand the expected certificate type.- Front Door metrics (
RequestCountbyHttpStatus, and origin health) return to baseline.
Communicate
"Users of
Prevent it next time
- Point managed-certificate domains straight at the Front Door endpoint with a CNAME, so renewal needs no action.
- Alert on domain validation state: a scheduled job that runs
az afd custom-domain listand pages on anything notApproved. - Use
useLatestVersionfor Key Vault certificates, enable auto-renewal in Key Vault, and alert on Key VaultCertificateNearExpiryevents through Event Grid. - Keep CAA records in IaC and include
digicert.comfor any domain on managed certificates. - Add an external TLS expiry check (30, 14 and 7 days) for every public hostname.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get