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/api-management-howto-mutual-certificates-for-clients.md
+41-18Lines changed: 41 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,33 +5,57 @@ description: Learn how to secure access to APIs by using client certificates. Yo
5
5
services: api-management
6
6
documentationcenter: ''
7
7
author: dlepow
8
-
manager: erikre
9
-
editor: ''
10
8
11
9
ms.service: api-management
12
-
ms.workload: mobile
13
-
ms.tgt_pltfrm: na
14
10
ms.topic: article
15
-
ms.date: 06/01/2021
11
+
ms.date: 01/12/2023
16
12
ms.author: danlep
13
+
ms.custom: engagement-fy23
17
14
---
18
15
19
16
# How to secure APIs using client certificate authentication in API Management
20
17
21
-
API Management provides the capability to secure access to APIs (i.e., client to API Management) using client certificates. You can validate certificates presented by the connecting client and check certificate properties against desired values using policy expressions.
18
+
API Management provides the capability to secure access to APIs (that is, client to API Management) using client certificates and mutual TLS authentication. You can validate certificates presented by the connecting client and check certificate properties against desired values using policy expressions.
22
19
23
-
For information about securing access to the back-end service of an API using client certificates (i.e., API Management to backend), see [How to secure back-end services using client certificate authentication](./api-management-howto-mutual-certificates.md).
20
+
For information about securing access to the backend service of an API using client certificates (that is, API Management to backend), see [How to secure back-end services using client certificate authentication](./api-management-howto-mutual-certificates.md).
24
21
25
22
For a conceptual overview of API authorization, see [Authentication and authorization in API Management](authentication-authorization-overview.md#gateway-data-plane).
26
23
24
+
## Certificate options
27
25
28
-
> [!IMPORTANT]
29
-
> To receive and verify client certificates over HTTP/2 in the Developer, Basic, Standard, or Premium tiers you must turn on the "Negotiate client certificate" setting on the "Custom domains" blade as shown below.
26
+
For certificate validation, API Management can check against certificates managed in your API Management instance. If you choose to use API Management to manage client certificates, you have the following options:
27
+
28
+
* Reference a certificate managed in [Azure Key Vault](../key-vault/general/overview.md)
29
+
* Add a certificate file directly in API Management
30
+
31
+
Using key vault certificates is recommended because it helps improve API Management security:
32
+
33
+
* Certificates stored in key vaults can be reused across services
34
+
* Granular [access policies](../key-vault/general/security-features.md#privileged-access) can be applied to certificates stored in key vaults
35
+
* Certificates updated in the key vault are automatically rotated in API Management. After update in the key vault, a certificate in API Management is updated within 4 hours. You can also manually refresh the certificate using the Azure portal or via the management REST API.
36
+
37
+
## Prerequisites
38
+
39
+
* If you have not created an API Management service instance yet, see [Create an API Management service instance](get-started-create-service-instance.md).
40
+
* You need access to the certificate and the password for management in an Azure key vault or upload to the API Management service. The certificate must be in **PFX** format. Self-signed certificates are allowed.
41
+
42
+
If you use a self-signed certificate, also install trusted root and intermediate [CA certificates](api-management-howto-ca-certificates.md) in your API Management instance.
43
+
44
+
> [!NOTE]
45
+
> CA certificates for certificate validation are not supported in the Consumption tier.
## Enable API Management instance to receive and verify client certificates
50
+
51
+
### Developer, Basic, Standard, or Premium tier
52
+
53
+
To receive and verify client certificates over HTTP/2 in the Developer, Basic, Standard, or Premium tiers, you must enable the **Negotiate client certificate** setting on the **Custom domain** blade as shown below.
> To receive and verify client certificates in the Consumption tier you must turn on the "Request client certificate" setting on the "Custom domains" blade as shown below.
57
+
### Consumption tier
58
+
To receive and verify client certificates in the Consumption tier, you must enable the **Request client certificate** setting on the **Custom domains** blade as shown below.
@@ -41,8 +65,6 @@ Use the [validate-client-certificate](validate-client-certificate-policy.md) pol
41
65
42
66
Configure the policy to validate one or more attributes including certificate issuer, subject, thumbprint, whether the certificate is validated against online revocation list, and others.
43
67
44
-
For more information, see [API Management access restriction policies](api-management-access-restriction-policies.md).
45
-
46
68
## Certificate validation with context variables
47
69
48
70
You can also create policy expressions with the [`context` variable](api-management-policy-expressions.md#ContextVariables) to check client certificates. Examples in the following sections show expressions using the `context.Request.Certificate` property and other `context` properties.
@@ -66,7 +88,7 @@ Below policies can be configured to check the issuer and subject of a client cer
66
88
```
67
89
68
90
> [!NOTE]
69
-
> To disable checking certificate revocation list use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
91
+
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
70
92
> If client certificate is self-signed, root (or intermediate) CA certificate(s) must be [uploaded](api-management-howto-ca-certificates.md) to API Management for `context.Request.Certificate.Verify()` and `context.Request.Certificate.VerifyNoRevocation()` to work.
71
93
72
94
### Checking the thumbprint
@@ -84,7 +106,7 @@ Below policies can be configured to check the thumbprint of a client certificate
84
106
```
85
107
86
108
> [!NOTE]
87
-
> To disable checking certificate revocation list use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
109
+
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
88
110
> If client certificate is self-signed, root (or intermediate) CA certificate(s) must be [uploaded](api-management-howto-ca-certificates.md) to API Management for `context.Request.Certificate.Verify()` and `context.Request.Certificate.VerifyNoRevocation()` to work.
89
111
90
112
### Checking a thumbprint against certificates uploaded to API Management
@@ -103,7 +125,7 @@ The following example shows how to check the thumbprint of a client certificate
103
125
```
104
126
105
127
> [!NOTE]
106
-
> To disable checking certificate revocation list use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
128
+
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
107
129
> If client certificate is self-signed, root (or intermediate) CA certificate(s) must be [uploaded](api-management-howto-ca-certificates.md) to API Management for `context.Request.Certificate.Verify()` and `context.Request.Certificate.VerifyNoRevocation()` to work.
108
130
109
131
> [!TIP]
@@ -112,5 +134,6 @@ The following example shows how to check the thumbprint of a client certificate
112
134
113
135
## Next steps
114
136
115
-
-[How to secure back-end services using client certificate authentication](./api-management-howto-mutual-certificates.md)
116
-
-[How to upload certificates](./api-management-howto-mutual-certificates.md)
137
+
-[How to secure backend services using client certificate authentication](./api-management-howto-mutual-certificates.md)
138
+
-[How to add a custom CA certificate in Azure API Management](./api-management-howto-ca-certificates.md)
139
+
- Learn about [policies in API Management](api-management-howto-policies.md)
# Secure backend services using client certificate authentication in Azure API Management
17
17
18
-
API Management allows you to secure access to the backend service of an API using client certificates. This guide shows how to manage certificates in an Azure API Management service instance using the Azure portal. It also explains how to configure an API to use a certificate to access a backend service.
18
+
API Management allows you to secure access to the backend service of an API using client certificates and mutual TLS authentication. This guide shows how to manage certificates in an Azure API Management service instance using the Azure portal. It also explains how to configure an API to use a certificate to access a backend service.
19
19
20
20
You can also manage API Management certificates using the [API Management REST API](/rest/api/apimanagement/current-ga/certificate).
21
21
@@ -36,73 +36,21 @@ Using key vault certificates is recommended because it helps improve API Managem
* If you have not created an API Management service instance yet, see [Create an API Management service instance][Create an API Management serviceinstance].
39
+
* If you have not created an API Management service instance yet, see [Create an API Management service instance](get-started-create-service-instance.md).
40
40
* You should have your backend service configured for client certificate authentication. To configure certificate authentication in the Azure App Service, refer to [this article][to configure certificate authentication in Azure WebSites refer to this article].
41
-
* You need access to the certificate and the password for management in an Azure key vault or upload to the API Management service. The certificate must be in **PFX** format. Self-signed certificates are allowed.
41
+
* You need access to the certificate and the password for management in an Azure key vault or upload to the API Management service. The certificate must be in **PFX** format. Self-signed certificates are allowed.
42
42
43
-
### Prerequisites for key vault integration
44
-
45
-
1. For steps to create a key vault, see [Quickstart: Create a key vault using the Azure portal](../key-vault/general/quick-create-portal.md).
46
-
1. Enable a system-assigned or user-assigned [managed identity](api-management-howto-use-managed-service-identity.md) in the API Management instance.
47
-
1. Assign a [key vault access policy](../key-vault/general/assign-access-policy-portal.md) to the managed identity with permissions to get and list secrets from the vault. To add the policy:
1. Select **Secret permissions**, then select **Get** and **List**.
51
-
1. In **Select principal**, select the resource name of your managed identity. If you're using a system-assigned identity, the principal is the name of your API Management instance.
52
-
1. Create or import a certificate to the key vault. See [Quickstart: Set and retrieve a certificate from Azure Key Vault using the Azure portal](../key-vault/certificates/quick-create-portal.md).
53
-
1. When adding a key vault certificate to your API Management instance, you must have permissions to list secrets from the key vault.
See [Prerequisites for key vault integration](#prerequisites-for-key-vault-integration).
60
-
61
-
> [!CAUTION]
62
-
> When using a key vault certificate in API Management, be careful not to delete the certificate, key vault, or managed identity used to access the key vault.
63
-
64
-
To add a key vault certificate to API Management:
65
-
66
-
1. In the [Azure portal](https://portal.azure.com), navigate to your API Management instance.
67
-
1. Under **Security**, select **Certificates**.
68
-
1. Select **Certificates** > **+ Add**.
69
-
1. In **Id**, enter a name of your choice.
70
-
1. In **Certificate**, select **Key vault**.
71
-
1. Enter the identifier of a key vault certificate, or choose **Select** to select a certificate from a key vault.
72
-
> [!IMPORTANT]
73
-
> If you enter a key vault certificate identifier yourself, ensure that it doesn't have version information. Otherwise, the certificate won't rotate automatically in API Management after an update in the key vault.
74
-
1. In **Client identity**, select a system-assigned or an existing user-assigned managed identity. Learn how to [add or modify managed identities in your API Management service](api-management-howto-use-managed-service-identity.md).
75
-
> [!NOTE]
76
-
> The identity needs permissions to get and list certificate from the key vault. If you haven't already configured access to the key vault, API Management prompts you so it can automatically configure the identity with the necessary permissions.
After the certificate is uploaded, it shows in the **Certificates** window. If you have many certificates, make a note of the thumbprint of the desired certificate in order to configure an API to use a client certificate for [gateway authentication](#configure-an-api-to-use-client-certificate-for-gateway-authentication).
103
53
104
-
> [!NOTE]
105
-
> To turn off certificate chain validation when using, for example, a self-signed certificate, follow the steps described in [Self-signed certificates](#self-signed-certificates), later in this article.
106
54
107
55
## Configure an API to use client certificate for gateway authentication
108
56
@@ -121,7 +69,7 @@ After the certificate is uploaded, it shows in the **Certificates** window. If y
121
69
> [!TIP]
122
70
> When a certificate is specified for gateway authentication for the backend service of an API, it becomes part of the policy for that API, and can be viewed in the policy editor.
123
71
124
-
## Self-signed certificates
72
+
## Disable certificate chain validation for self-signed certificates
125
73
126
74
If you are using self-signed certificates, you will need to disable certificate chain validation for API Management to communicate with the backend system. Otherwise it will return a 500 error code. To configure this, you can use the [`New-AzApiManagementBackend`](/powershell/module/az.apimanagement/new-azapimanagementbackend) (for new backend) or [`Set-AzApiManagementBackend`](/powershell/module/az.apimanagement/set-azapimanagementbackend) (for existing backend) PowerShell cmdlets and set the `-SkipCertificateChainValidation` parameter to `True`.
127
75
@@ -144,6 +92,7 @@ To delete a certificate, select it and then select **Delete** from the context m
144
92
## Next steps
145
93
146
94
*[How to secure APIs using client certificate authentication in API Management](api-management-howto-mutual-certificates-for-clients.md)
95
+
*[How to add a custom CA certificate in Azure API Management](./api-management-howto-ca-certificates.md)
147
96
* Learn about [policies in API Management](api-management-howto-policies.md)
0 commit comments