Custom domain of APIM and cname setting

Spai 71 Reputation points
2021-01-16T15:22:12.407+00:00

We just configure custom domain in APIM and IT department also adds CNAME for us.
The setting is like this
mycompany.com CNAME myapim.azure-api.net

It works fine when we go to mycompany.com via browser and it shows developer portal.
The nslookup result is here.
57346-image.png

What interests me is, why does this CNAME work ?
I think it's supposed to map to portal ( myapim.developer.azure-api.net ) instead of gateway url, but surprisingly it works.

Another question is from this article.
I know APIM would have both private and public ip when established in vnet.
I'm wondering if every service of APIM has their own private/public ip ?
The services I mention here are

There are a number of endpoints to which you can assign a custom domain name. Currently, the following endpoints are available:
Gateway (default is: <apim-service-name>.azure-api.net),
Developer portal (legacy) (default is: <apim-service-name>.portal.azure-api.net),
Developer portal (default is: <apim-service-name>.developer.azure-api.net).
Management (default is: <apim-service-name>.management.azure-api.net),
SCM (default is: <apim-service-name>.scm.azure-api.net),

Thank you

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,447 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,656 Reputation points Microsoft Employee Moderator
    2021-01-18T04:45:40.28+00:00

    While the CNAME record allows DNS queries to resolve to the IP of the APIM hostname, you still need to setup a Custom Domain on APIM for everything to work.

    In your case, it is likely the domain - mycompany.com - has been setup as a custom domain for myapim.developer.azure-api.net, hence the behavior you observe. APIM runs all of these services on the same host (sharing the same IPs) and leverage the Host header to decide which service a request is meant for.

    This why though the CNAME record is for myapim.azure-api.net, the IP resolved is still pointing to the same instance but the configuration in APIM makes the request to serve the developer portal instead.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.