Skip to content

Commit 80e9935

Browse files
committed
revise for review comments, wip
1 parent b0f08ce commit 80e9935

File tree

1 file changed

+86
-87
lines changed

1 file changed

+86
-87
lines changed

articles/api-management/configure-custom-domain.md

Lines changed: 86 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -8,123 +8,108 @@ author: dlepow
88

99
ms.service: api-management
1010
ms.topic: how-to
11-
ms.date: 11/15/2021
11+
ms.date: 12/08/2021
1212
ms.author: danlep
1313
---
1414

1515
# Configure a custom domain name for your Azure API Management instance
1616

17-
When you create an Azure API Management service instance, 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.
17+
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.
1818

1919
> [!IMPORTANT]
2020
> API Management accepts only requests with [host header](https://tools.ietf.org/html/rfc2616#section-14.23) values matching:
2121
>
2222
>* The default domain name
2323
>* Any of the configured custom domain names
2424
25-
The following table lists the options you have for adding domain certificates in API Management:
26-
27-
|Option|Description|
28-
|-|-|
29-
| Enable a free [managed TLS certificate](#managed-tls-certificate) (preview) | A certificate that's free of charge and easy to use if you just need to secure your domain in your API Management service. |
30-
| Import a certificate from Key Vault | Useful if you use [Azure Key Vault](../key-vault/index.yml) to manage your PKCS12 certificates. See [Private certificate requirements](#private-certificate-requirements). |
31-
| Upload a private certificate | If you already have a private certificate from a third-party provider, you can upload it. See [Private certificate requirements](#private-certificate-requirements). |
32-
33-
> [!WARNING]
34-
> If you wish to improve the security of your applications with certificate pinning, you should use a custom domain name and certificate that you manage, 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.
35-
3625
## Prerequisites
3726

3827
- An active Azure subscription. [!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
3928
- An API Management instance. For more information, see [Create an Azure API Management instance](get-started-create-service-instance.md).
4029
- A custom domain name that is owned by you or your organization. This topic does not provide instructions on how to procure a custom domain name.
4130
- Optionally, a valid certificate with a public and private key (.PFX). Subject or subject alternative name (SAN) has to match the domain name (this enables API Management instance to securely expose URLs over TLS).
4231

43-
See [Private certificate requirements](#private-certificate-requirements).
32+
See [Domain certificate options](#domain-certificate-options).
4433

45-
- 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 [Configure DNS records](#configure-dns-records), later in this article.
46-
47-
## Private certificate requirements
34+
- 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.
4835

49-
If you choose to upload or import a private certificate to API Management, your certificate must meet the following requirements. If you use a free certificate managed by API Management, it already meets these requirements.
36+
For more information about required records, see [Configure DNS records](#configure-dns-records), later in this article.
37+
5038

51-
* Exported as a PFX file, encrypted using triple DES, and optionally password protected.
52-
* Contains private key at least 2048 bits long
53-
* Contains all intermediate certificates and the root certificate in the certificate chain.
39+
## Endpoints for custom domains
5440

55-
## Managed TLS certificate
41+
There are several API Management service endpoints to which you can assign a custom domain name. Currently, the following endpoints are available:
5642

57-
API Management offers a free, managed TLS certificate for your domain, if you don't wish to purchase and manage your own certificate. The certificate is autorenewed automatically.
43+
| Endpoint | Default |
44+
| -------- | ----------- |
45+
| **Gateway** | Default is: `<apim-service-name>.azure-api.net`. Gateway is the only endpoint available for configuration in the Consumption tier.<br/><br/>The default Gateway endpoint configuration remains after a custom Gateway domain is added. |
46+
| **Developer portal (legacy)** | Default is: `<apim-service-name>.portal.azure-api.net` |
47+
| **Developer portal** | Default is: `<apim-service-name>.developer.azure-api.net` |
48+
| **Management** | Default is: `<apim-service-name>.management.azure-api.net` |
49+
| **SCM** | Default is: `<apim-service-name>.scm.azure-api.net` |
5850

5951
> [!NOTE]
60-
> The free, managed TLS certificate is available for all API Management service tiers. It is currently in preview.
52+
> You can update any of the endpoints supported in your service tier. Typically, customers update **Gateway** (this URL is used to call the API exposed through API Management) and **Portal** (the developer portal URL).
53+
>
54+
> Only API Management instance owners can use **Management** and **SCM** endpoints internally. These endpoints are less frequently assigned a custom domain name.
55+
>
56+
> The **Premium** and **Developer** tiers support setting multiple hostnames for the **Gateway** endpoint.
6157
62-
### Limitations
58+
## Domain certificate options
6359

64-
* Currently can be used only with the Gateway endpoint of your API Management service
65-
* Not supported in the following Azure regions: France South and South Africa West
66-
* Currently available only in the Azure cloud
67-
* Does not support root domain names (for example, `contoso.com`). Requires a fully qualified name such as `api.contoso.com`.
60+
The following table lists the options you have for adding domain certificates in API Management:
6861

69-
## Configure DNS records
70-
* [DNS configuration for private certificate](#dns-configuration-for-private-certificate)
71-
* [DNS configuration for managed certificate](#dns-configuration-for-managed-certificate)
62+
|Option|Description|
63+
|-|-|
64+
| Upload a [private certificate](#private-certificate) | If you already have a private certificate from a third-party provider, you can upload it to your API Management instance. |
65+
| Import a [certificate from Key Vault](#key-vault-certificate) | Useful if you use [Azure Key Vault](../key-vault/index.yml) to manage your PKCS12 certificates. |
66+
| Enable a free [managed TLS certificate](#managed-tls-certificate) (preview) | A certificate that's free of charge and easy to use if you just need to secure your Gateway domain in your API Management service. |
7267

73-
### DNS configuration for private certificate
68+
> [!WARNING]
69+
> If you wish to improve the security of your applications with certificate pinning, you should use a custom domain name and certificate that you manage, 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.
7470
75-
When using a private certificate for your custom domain name, you can either:
71+
### Private certificate
7672

77-
- Configure a CNAME-record that points to the endpoint of your configured custom domain name, or
78-
- Configure an A-record that points to your API Management gateway IP address.
73+
If you choose to upload or import a private certificate to API Management, your certificate must meet the following requirements. If you use a free certificate managed by API Management, it already meets these requirements.
7974

80-
While CNAME-records (or alias records) and A-records both allow you to associate a domain name with a specific server or service, they work differently.
75+
* Exported as a PFX file, encrypted using triple DES, and optionally password protected.
76+
* Contains private key at least 2048 bits long
77+
* Contains all intermediate certificates and the root certificate in the certificate chain.
8178

82-
#### CNAME or Alias record
83-
A CNAME-record maps a *specific* domain (such as `contoso.com` or `www.contoso.com`) to a canonical domain name. Once created, the CNAME creates an alias for the domain. The CNAME entry will resolve to the IP address of your custom domain service automatically, so if the IP address changes, you do not have to take any action.
79+
### Key vault certificate
8480

85-
> [!NOTE]
86-
> Some domain registrars only allow you to map subdomains when using a CNAME-record, such as `www.contoso.com`, and not root names, such as `contoso.com`. For more information on CNAME-records, see the documentation provided by your registrar, [the Wikipedia entry on CNAME-record](https://en.wikipedia.org/wiki/CNAME_record), or the [IETF Domain Names - Implementation and Specification](https://tools.ietf.org/html/rfc1035) document.
81+
When using [Azure Key Vault for managing certificates](../key-vault/certificates/about-certificates.md), set them to `autorenew`.
8782

88-
#### A-record
89-
An A-record maps a domain, such as `contoso.com` or `www.contoso.com`, *or a wildcard domain*, such as `*.contoso.com`, to an IP address. Since an A-record is mapped to a static IP address, it cannot automatically resolve changes to the IP address. We recommend using the more stable CNAME-record instead of an A-record.
83+
If you use Azure Key Vault to manage the custom domain TLS/SSL certificate, make sure the certificate is inserted into Key Vault [as a _certificate_](/rest/api/keyvault/createcertificate/createcertificate), not a _secret_.
9084

91-
> [!NOTE]
92-
> Although the API Management instance IP address is static, it may change in a few scenarios. When choosing the DNS configuration method, we recommend using a CNAME-record when configuring custom domain, as it is more stable than an A-record in case the IP changes. Read more in [IP addresses of Azure API Management](api-management-howto-ip-addresses.md#changes-to-the-ip-addresses) and the [API Management FAQ](./api-management-faq.yml#how-can-i-secure-the-connection-between-the-api-management-gateway-and-my-back-end-services-).
85+
To fetch a TLS/SSL certificate, API Management must have the list and get secrets permissions on the Azure Key Vault containing the certificate.
9386

94-
### DNS configuration for managed certificate
87+
* When using the Azure portal to import the certificate, all the necessary configuration steps are completed automatically.
88+
* When using command line tools or management API, these permissions must be granted manually, in two steps:
89+
1. On the **Managed identities** page of your API Management instance, enable a system-assigned or user-assigned [managed identity](api-management-howto-use-managed-service-identity.md). Note the principal id on that page.
90+
1. Give the list and get secrets permissions to this principal id on the Azure Key Vault containing the certificate.
9591

96-
When enabling the free, managed certificate for API Management, configure the following required DNS records in your DNS zone. In the following example, the custom domain name is `api.contoso.com`.
92+
If the certificate is set to `autorenew` and your API Management tier has an SLA (i.e., in all tiers except the Developer tier), API Management will pick up the latest version automatically, without any downtime to the service.
9793

98-
1. Create a TXT record
99-
1. Get a record identifier by calling the [Get Domain Ownership Identifier](/rest/api/apimanagement/2021-01-01-preview/api-management-service/get-domain-ownership-identifier) REST API.
100-
1. Create a TXT record with the name of your custom domain prefixed by `apimuid`. Example name: `apimuid.api.contoso.com`.
101-
1. Assign the value as the domain ownership identifier returned in a previous step.
102-
1. Create a CNAME record
103-
* Point from your custom domain name (`api.contoso.com`) to your API Management service hostname (for example, `apim-service-name.azure-api.net`).
94+
### Managed TLS certificate
10495

105-
## Set a custom domain name - portal
96+
API Management offers a free, managed TLS certificate for your domain, if you don't wish to purchase and manage your own certificate. The certificate is autorenewed automatically.
10697

107-
1. Navigate to your API Management instance in the [Azure portal](https://portal.azure.com/).
108-
1. Select **Custom domains**.
98+
> [!NOTE]
99+
> The free, managed TLS certificate is available for all API Management service tiers. It is currently in preview.
109100
110-
There are several endpoints to which you can assign a custom domain name. Currently, the following endpoints are available:
101+
#### Limitations
111102

112-
| Endpoint | Default |
113-
| -------- | ----------- |
114-
| **Gateway** | Default is: `<apim-service-name>.azure-api.net`. Gateway is the only endpoint available for configuration in the Consumption tier and when using the free, managed certificate. |
115-
| **Developer portal (legacy)** | Default is: `<apim-service-name>.portal.azure-api.net` |
116-
| **Developer portal** | Default is: `<apim-service-name>.developer.azure-api.net` |
117-
| **Management** | Default is: `<apim-service-name>.management.azure-api.net` |
118-
| **SCM** | Default is: `<apim-service-name>.scm.azure-api.net` |
103+
* Currently can be used only with the Gateway endpoint of your API Management service
104+
* Not supported in the following Azure regions: France South and South Africa West
105+
* Currently available only in the Azure cloud
106+
* Does not support root domain names (for example, `contoso.com`). Requires a fully qualified name such as `api.contoso.com`.
119107

120-
> [!NOTE]
121-
> You can update any of the endpoints. Typically, customers update **Gateway** (this URL is used to call the API exposed through API Management) and **Portal** (the developer portal URL).
122-
>
123-
> Only API Management instance owners can use **Management** and **SCM** endpoints internally. These endpoints are less frequently assigned a custom domain name.
124-
>
125-
> The **Premium** and **Developer** tiers support setting multiple host names for the **Gateway** endpoint.
108+
## Set a custom domain name - portal
126109

127-
1. Select **+Add**, or select an existing endpoint that you want to update.
110+
1. Navigate to your API Management instance in the [Azure portal](https://portal.azure.com/).
111+
1. In the left navigation, select **Custom domains**.
112+
1. Select **+Add**, or select an existing [endpoint](#endpoints-for-custom-domains) that you want to update.
128113
1. In the window on the right, select the **Type** of endpoint for the custom domain.
129114
1. In the **Hostname** field, specify the name you want to use. For example, `api.contoso.com`.
130115
1. Under **Certificate**, select one of the following:
@@ -135,38 +120,52 @@ When enabling the free, managed certificate for API Management, configure the fo
135120
- Once the certificates have loaded, select the **Certificate** from the dropdown list.
136121
- Click **Select**.
137122
- **Custom**
138-
- Select the **Certificate file** field to select and upload a certificate.
123+
- Select **Certificate file** to select and upload a certificate.
139124
- Upload a valid .PFX file and provide its **Password**, if the certificate is protected with a password.
140125
- **Managed**
141126
- Select if you want to use a free certificate managed by API Management (available in preview for the Gateway endpoint only).
127+
128+
The DNS TXT record value to configure is displayed. Copy this value to use to [configure a DNS record](#configure-dns-records).
142129
1. When configuring a Gateway endpoint, select or deselect [other options as necessary](#clients-calling-with-server-name-indication-sni-header), like **Negotiate client certificate** or **Default SSL binding**.
143130
1. Select **Update**.
144131

145132
> [!NOTE]
146133
> Wildcard domain names, like `*.contoso.com`, are supported in all tiers except the Consumption tier.
147134
148-
> [!TIP]
149-
> When using [Azure Key Vault for managing certificates](../key-vault/certificates/about-certificates.md), set them to `autorenew`.
150-
>
151-
> If you use Azure Key Vault to manage the custom domain TLS/SSL certificate, make sure the certificate is inserted into Key Vault [as a _certificate_](/rest/api/keyvault/createcertificate/createcertificate), not a _secret_.
152-
>
153-
> To fetch a TLS/SSL certificate, API Management must have the list and get secrets permissions on the Azure Key Vault containing the certificate.
154-
>
155-
>* When using Azure portal, all the necessary configuration steps will be completed automatically.
156-
>* When using command line tools or management API, these permissions must be granted manually, in two steps:
157-
> * Using the **Managed identities** page on your API Management instance, ensure that Managed Identity is enabled and note the principal id on that page.
158-
> * Give the list and get secrets permissions to this principal id on the Azure Key Vault containing the certificate.
159-
>
160-
> If the certificate is set to `autorenew` and your API Management tier has SLA (i.e., in all tiers except the Developer tier), API Management will pick up the latest version automatically, without any downtime to the service.
161-
135+
162136
1. Click **Apply**.
163137

164138
> [!NOTE]
165-
> The process of assigning the certificate may take 15 minutes or more depending on size of deployment. Developer SKU has downtime, while Basic and higher SKUs do not.
139+
> The process of assigning the certificate may take 15 minutes or more depending on size of deployment. Developer tier has downtime, while Basic and higher tiers do not.
166140
167141
[!INCLUDE [api-management-custom-domain](../../includes/api-management-custom-domain.md)]
168142

143+
## Configure DNS records
144+
145+
Configure DNS records for your custom domain in your DNS zone.
146+
147+
* [DNS configuration for private certificate](#dns-configuration-for-private-certificate)
148+
* [DNS configuration for managed TLS certificate](#dns-configuration-for-managed-tls-certificate)
149+
150+
### DNS configuration for private certificate
151+
152+
When using a private certificate for your custom domain name, it's recommended to configure a CNAME-record that points to the endpoint of your configured custom domain name. A CNAME-record is more stable than an A-record in case the IP changes. Read more in [IP addresses of Azure API Management](api-management-howto-ip-addresses.md#changes-to-the-ip-addresses) and the [API Management FAQ](./api-management-faq.yml#how-can-i-secure-the-connection-between-the-api-management-gateway-and-my-back-end-services-).
169153

154+
> [!NOTE]
155+
> Some domain registrars only allow you to map subdomains when using a CNAME-record, such as `www.contoso.com`, and not root names, such as `contoso.com`. For more information on CNAME-records, see the documentation provided by your registrar or the [IETF Domain Names - Implementation and Specification](https://tools.ietf.org/html/rfc1035) document.
156+
157+
### DNS configuration for managed TLS certificate
158+
159+
When enabling the free, managed certificate for API Management, configure the following required DNS records in your DNS zone. In the following example, the custom domain name is `api.contoso.com`.
160+
161+
1. Create a TXT record
162+
1. Get a domain ownership identifier by calling the [Get Domain Ownership Identifier](/rest/api/apimanagement/2021-08-01/api-management-service/get-domain-ownership-identifier) REST API.
163+
164+
This identifier is also displayed in the portal when you select to configure a managed certificate for your Gateway endpoint.
165+
1. Create a TXT record with the name of you custom domain prefixed by `apimuid`. Example name: `apimuid.api.contoso.com`.
166+
1. Assign the domain ownership identifier as the record value.
167+
1. Create a CNAME record
168+
* Point from your custom domain name (`api.contoso.com`) to your API Management service hostname (for example, `<apim-service-name>.azure-api.net`).
170169

171170
## Next steps
172171

0 commit comments

Comments
 (0)