Configure a custom domain name for your Azure API Management instance

When you create an Azure API Management service instance in the Azure cloud, Azure assigns it a azure-api.net subdomain (for example, apim-service-name.azure-api.net). You can also expose your API Management endpoints using your own custom domain name, such as contoso.com. This article shows you how to map an existing custom DNS name to endpoints exposed by an API Management instance.

Important

API Management only accepts requests with host header values matching:

  • The Gateway's default domain name
  • Any of the Gateway's configured custom domain names

Prerequisites

  • An API Management instance. For more information, see Create an Azure API Management instance.

  • A custom domain name that is owned by you or your organization. This article does not provide instructions on how to procure a custom domain name.

  • Optionally, a valid certificate with a public and private key (.PFX). The subject or subject alternative name (SAN) has to match the domain name (this enables API Management instance to securely expose URLs over TLS).

    See Domain certificate options.

  • DNS records hosted on a DNS server to map the custom domain name to the default domain name of your API Management instance. This topic does not provide instructions on how to host the DNS records.

    For more information about required records, see DNS configuration, later in this article.

Endpoints for custom domains

There are several API Management endpoints to which you can assign a custom domain name. Currently, the following endpoints are available:

Endpoint Default
Gateway Default is: <apim-service-name>.azure-api.net. Gateway is the only endpoint available for configuration in the Consumption tier.

The default Gateway endpoint configuration remains available after a custom Gateway domain is added.
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

Considerations

  • You can update any of the endpoints supported in your service tier. Typically, customers update Gateway (this URL is used to call the APIs exposed through API Management) and Developer portal (the developer portal URL).
  • The default Gateway endpoint also is available after you configure a custom Gateway domain name. For other API Management endpoints (such as Developer portal) that you configure with a custom domain name, the default endpoint is no longer available.
  • Only API Management instance owners can use Management and SCM endpoints internally. These endpoints are less frequently assigned a custom domain name.
  • The Premium and Developer tiers support setting multiple hostnames for the Gateway endpoint.
  • Wildcard domain names, like *.contoso.com, are supported in all tiers except the Consumption tier. A specific subdomain certificate (for example, api.contoso.com) would take precedence over a wildcard certificate (*.contoso.com) for requests to api.contoso.com.

Domain certificate options

API Management supports custom TLS certificates or certificates imported from Azure Key Vault. You can also enable a free, managed certificate.

Warning

If you require certificate pinning, please use a custom domain name and either a custom or Key Vault certificate, not the default certificate or the free, managed certificate. We don't recommend taking a hard dependency on a certificate that you don't manage.

If you already have a private certificate from a third-party provider, you can upload it to your API Management instance. It must meet the following requirements. (If you enable the free certificate managed by API Management, it already meets these requirements.)

  • Exported as a PFX file, encrypted using triple DES, and optionally password protected.
  • Contains private key at least 2048 bits long
  • Contains all intermediate certificates and the root certificate in the certificate chain.

Set a custom domain name - portal

Choose the steps according to the domain certificate you want to use.

  1. Navigate to your API Management instance in the Azure portal.
  2. In the left navigation, select Custom domains.
  3. Select +Add, or select an existing endpoint that you want to update.
  4. In the window on the right, select the Type of endpoint for the custom domain.
  5. In the Hostname field, specify the name you want to use. For example, api.contoso.com.
  6. Under Certificate, select Custom
  7. Select Certificate file to select and upload a certificate.
  8. Upload a valid .PFX file and provide its Password, if the certificate is protected with a password.
  9. When configuring a Gateway endpoint, select or deselect other options as necessary, including Negotiate client certificate or Default SSL binding. Configure gateway domain with custom certificate
  10. Select Add, or select Update for an existing endpoint.
  11. Select Save.