Skip to content

Your Certificate Renewed. Your Gateway Didn’t Notice.

A setup that looks fine


API Management sits behind a global entry point like Traffic Manager or Front Door. Your custom domain, api.contoso.com, points at that entry point. APIM holds the same custom domain, with a certificate pulled from Key Vault. It works, for months. 


Then the certificate renews, APIM tries to pick up the new version, and validation fails. Same infrastructure, same DNS, same everything. 


It’s not your fault. It’s a mismatch between what validation checks and what your architecture actually looks like.


What is actually happening


APIM’s custom domain validation expects a CNAME pointing directly at the gateway’s default hostname, yourapim.azure-api.net. Put a global entry point in front, and your public CNAME points at that instead, which is the whole reason you deployed it. Validation resolves the domain, expects to find its own gateway, finds something else, and fails. 


This is a documented constraint: in Standard v2 and Premium v2, APIM requires a publicly resolvable DNS name for the gateway endpoint. In practice, validation also doesn’t accommodate a custom domain that resolves to Traffic Manager, Front Door, or Application Gateway sitting in front of the instance. 


Figure 1. What validation expects to find, and what it finds when something sits in front.

Why it takes so long to notice


Day one, DNS may not yet point at the front door, or that layer went in afterwards, so validation passes. Everything’s green. 


Months later, the certificate renews and validation runs again. This time it fails. Nobody changed anything; the person who built the topology may have moved on. 


Worse, when APIM can’t fetch the new certificate, it doesn’t fail loudly. It keeps serving the cached one. Your gateway stays up, monitoring stays green. It’s a sync error in a log nobody watches. Only when the cached certificate actually expires does traffic get blocked, arriving as an outage with no obvious link to a failure from weeks earlier. 


Figure 2. The gap between the change and the symptom is measured in months.

The fix: stop making the gateway own the name


Don’t fight validation with DNS tricks or a manual repoint-rotate-repoint dance every cycle. Instead, put the custom domain on the thing users actually reach, and let APIM keep its default hostname. 


If Front Door or Application Gateway is your entry point, that’s where api.contoso.com and its certificate belong. That layer terminates TLS and forwards to APIM’s default hostname. APIM has nothing left to validate against public DNS, so the problem disappears permanently, no scripts required. You lose nothing: APIM still enforces every policy, rate limiting, subscription keys, token validation. 


Figure 3. Moving the custom domain to the edge removes the thing that fails.

Two things to weigh while you are there.



  • Order your edge deliberately. If you run a WAF, put it in front of everything. Don’t let APIM absorb hostile traffic at the layer all your APIs depend on. 

  • Check if you even need the front layer. Some teams run two APIM instances behind Traffic Manager or Front Door only because their tier lacked multi-region support or multiple custom hostnames. Higher tiers support both, which may let you collapse the whole topology into one instance. 


An operational checklist


Whatever topology you land on, these are worth having in place.



  • Confirm the certificate is stored in Key Vault as a certificate, not as a secret. They look similar in the portal and behave differently here.

  • Check the managed identity used to reach Key Vault still exists, and that API Management has list and get permissions on secrets. There is a Restore action that repairs access automatically when the portal detects a problem.

  • If your instance is in a virtual network, confirm outbound connectivity to the Key Vault service tag. A blocked egress path produces the same silent staleness.

  • Read the sync logs. There is a View sync logs action that gives root-cause detail on failed synchronisation. It is the fastest route from something is wrong to here is what is wrong.

  • Auto-renewal pickup can take one to two days. Use Sync certificates to trigger it manually. 

  • Alert on certificate expiry, not just on gateway health. The whole failure mode lives in the space between those two signals.

  • Test a rotation before you need one. Force a renewal in a non-production instance with your real topology in place. If it fails there, you have months to fix it rather than hours.


The takeaway


A validation check that passes at deployment is not the same as one that passes at renewal.


Anything that resolves a name, checks a permission or reaches a dependency is being evaluated again later, under conditions you cannot see from the deployment log. 


If you are running API Management with a custom domain behind any kind of global entry point, you can find out today whether your next rotation will succeed. That is a much better day to discover it than the one where the cached certificate runs out.


References


Microsoft Tech Community originally posted this article on 17 September 2026 at 9:56 PM.

Leave a Reply