You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/api-management/configure-custom-domain.md
+86-87Lines changed: 86 additions & 87 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,123 +8,108 @@ author: dlepow
8
8
9
9
ms.service: api-management
10
10
ms.topic: how-to
11
-
ms.date: 11/15/2021
11
+
ms.date: 12/08/2021
12
12
ms.author: danlep
13
13
---
14
14
15
15
# Configure a custom domain name for your Azure API Management instance
16
16
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.
18
18
19
19
> [!IMPORTANT]
20
20
> API Management accepts only requests with [host header](https://tools.ietf.org/html/rfc2616#section-14.23) values matching:
21
21
>
22
22
>* The default domain name
23
23
>* Any of the configured custom domain names
24
24
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
-
36
25
## Prerequisites
37
26
38
27
- An active Azure subscription. [!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
39
28
- An API Management instance. For more information, see [Create an Azure API Management instance](get-started-create-service-instance.md).
40
29
- 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.
41
30
- 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).
42
31
43
-
See [Private certificate requirements](#private-certificate-requirements).
32
+
See [Domain certificate options](#domain-certificate-options).
44
33
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.
48
35
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
+
50
38
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
54
40
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:
56
42
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`|
58
50
59
51
> [!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.
61
57
62
-
### Limitations
58
+
##Domain certificate options
63
59
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:
68
61
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. |
72
67
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.
74
70
75
-
When using a private certificate for your custom domain name, you can either:
71
+
### Private certificate
76
72
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.
79
74
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.
81
78
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
84
80
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`.
87
82
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_.
90
84
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.
93
86
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.
95
91
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.
97
93
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
104
95
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.
106
97
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.
109
100
110
-
There are several endpoints to which you can assign a custom domain name. Currently, the following endpoints are available:
101
+
#### Limitations
111
102
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`.
119
107
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
126
109
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.
128
113
1. In the window on the right, select the **Type** of endpoint for the custom domain.
129
114
1. In the **Hostname** field, specify the name you want to use. For example, `api.contoso.com`.
130
115
1. Under **Certificate**, select one of the following:
@@ -135,38 +120,52 @@ When enabling the free, managed certificate for API Management, configure the fo
135
120
- Once the certificates have loaded, select the **Certificate** from the dropdown list.
136
121
- Click **Select**.
137
122
-**Custom**
138
-
- Select the **Certificate file** field to select and upload a certificate.
123
+
- Select **Certificate file** to select and upload a certificate.
139
124
- Upload a valid .PFX file and provide its **Password**, if the certificate is protected with a password.
140
125
-**Managed**
141
126
- 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).
142
129
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**.
143
130
1. Select **Update**.
144
131
145
132
> [!NOTE]
146
133
> Wildcard domain names, like `*.contoso.com`, are supported in all tiers except the Consumption tier.
147
134
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
+
162
136
1. Click **Apply**.
163
137
164
138
> [!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.
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-).
169
153
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`).
0 commit comments