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.