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
+44-26Lines changed: 44 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@ titleSuffix: Azure API Management
4
4
description: Learn how to secure access to APIs by using client certificates. You can use policy expressions to validate incoming certificates.
5
5
services: api-management
6
6
author: dlepow
7
-
8
7
ms.service: azure-api-management
9
8
ms.topic: how-to
10
-
ms.date: 10/30/2024
9
+
ms.date: 01/29/2026
11
10
ms.author: danlep
12
11
ms.custom:
13
12
- engagement-fy23
14
13
- sfi-image-nochange
14
+
#customer intent: As a developer using API Management, I want to use client certificates for authentication, including working with Azure Key Vault.
15
15
---
16
16
17
17
# How to secure APIs using client certificate authentication in API Management
@@ -28,44 +28,54 @@ For a conceptual overview of API authorization, see [Authentication and authoriz
28
28
29
29
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:
30
30
31
-
* Reference a certificate managed in [Azure Key Vault](/azure/key-vault/general/overview)
32
-
* Add a certificate file directly in API Management
31
+
- Reference a certificate managed in [Azure Key Vault](/azure/key-vault/general/overview)
32
+
- Add a certificate file directly in API Management
Using key vault certificates is recommended because it helps improve API Management security:
36
+
We recommend using key vault certificates because the approach helps improve API Management security:
37
37
38
-
* Certificates stored in key vaults can be reused across services
39
-
* Granular [access policies](/azure/key-vault/general/security-features#privileged-access) can be applied to certificates stored in key vaults
40
-
* 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.
38
+
- Certificates stored in key vaults can be reused across services
39
+
- You can apply granular [access policies](/azure/key-vault/general/security-features#privileged-access) to certificates stored in key vaults
40
+
- 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 by using the management REST API.
41
41
42
42
## Prerequisites
43
43
44
-
* If you haven't created an API Management service instance yet, see [Create an API Management service instance](get-started-create-service-instance.md).
45
-
* 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 either CER or PFX format. Self-signed certificates are allowed.
44
+
- If you haven't created an API Management service instance yet, see [Create an API Management service instance](get-started-create-service-instance.md).
45
+
- 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 either CER or PFX format. Self-signed certificates are allowed.
46
46
47
-
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.
47
+
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.
48
48
49
-
> [!NOTE]
50
-
> CA certificates for certificate validation aren't supported in the Consumption tier.
49
+
> [!NOTE]
50
+
>
51
+
> CA certificates for certificate validation aren't supported in the Consumption tier.
> If you only wish to use the certificate to authenticate the client with API Management, you can upload a CER file.
56
+
>
57
+
> If you only want to use the certificate to authenticate the client with API Management, you can upload a CER file.
56
58
57
59
## Enable API Management instance to receive and verify client certificates
58
60
59
61
### Developer, Basic, Standard, or Premium tier
60
62
61
-
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 for **Custom domains**.
63
+
To receive and verify client certificates over HTTP/2 in the Developer, Basic, Standard, or Premium tiers, you must enable the **Negotiate client certificate**.
64
+
65
+
1. Select **Deployment + infrastructure**, then **Custom domains**.
66
+
1. Select the gateway hostname.
67
+
1. In the **Gateway** pane, select **Negotiate client certificate**.
62
68
63
-
:::image type="content" source="./media/api-management-howto-mutual-certificates-for-clients/negotiate-client-certificate.png" alt-text="Screenshot shows the negotiate client certificate option for a custom domain.":::
69
+
:::image type="content" source="./media/api-management-howto-mutual-certificates-for-clients/negotiate-client-certificate.png" alt-text="Screenshot shows the negotiate client certificate option for a custom domain.":::
64
70
65
71
### Consumption, Basic v2, Standard v2, or Premium v2 tier
66
-
To receive and verify client certificates in the Consumption, Basic v2, Standard v2, or Premium v2 tier, you must enable the **Request client certificate** setting for **Custom domains**.
67
72
68
-
:::image type="content" source="./media/api-management-howto-mutual-certificates-for-clients/request-client-certificate.png" alt-text="Screenshot shows the option to request client certificate for custom domains.":::
73
+
To receive and verify client certificates in the Consumption, Basic v2, Standard v2, or Premium v2 tier, you must enable the **Request client certificate**.
74
+
75
+
1. Select **Deployment + infrastructure**, then **Custom domains**.
76
+
1. Under **Client certificates**, enable **Request client certificate**.
77
+
78
+
:::image type="content" source="./media/api-management-howto-mutual-certificates-for-clients/request-client-certificate.png" alt-text="Screenshot shows the option to request client certificate for custom domains.":::
69
79
70
80
## Policy to validate client certificates
71
81
@@ -78,16 +88,20 @@ Configure the policy to validate one or more attributes including certificate is
78
88
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.
79
89
80
90
> [!NOTE]
81
-
> Mutual certificate authentication might not function correctly when the API Management gateway endpoint is exposed through the Application Gateway. The Application Gateway functions as a Layer 7 load balancer, establishing a distinct TLS connection with the backend API Management service. The certificate attached by the client in the initial HTTP request isn't forwarded to APIM. However, as a workaround, you can transmit the certificate using the server variables option. For detailed instructions, refer to [Mutual Authentication Server Variables](../application-gateway/rewrite-http-headers-url.md#mutual-authentication-server-variables).
91
+
>
92
+
> Mutual certificate authentication might not function correctly when the API Management gateway endpoint is exposed through the Application Gateway. The Application Gateway functions as a Layer 7 load balancer, establishing a distinct TLS connection with the backend API Management service. The certificate attached by the client in the initial HTTP request isn't forwarded to APIM.
93
+
>
94
+
> As a workaround, you can transmit the certificate using the server variables option. For more information, see [Mutual Authentication Server Variables](../application-gateway/rewrite-http-headers-url.md#mutual-authentication-server-variables).
82
95
83
96
> [!IMPORTANT]
84
-
> * Starting May 2021, the `context.Request.Certificate` property only requests the certificate when the API Management instance's [`hostnameConfiguration`](/rest/api/apimanagement/current-ga/api-management-service/create-or-update#hostnameconfiguration) sets the `negotiateClientCertificate` property to True. By default, `negotiateClientCertificate` is set to False.
85
-
> * If TLS renegotiation is disabled in your client, you might see TLS errors when requesting the certificate using the `context.Request.Certificate` property. If the errors appear, enable TLS renegotiation settings in the client.
86
-
> * Certification renegotiation isn't supported in the API Management v2 tiers.
97
+
>
98
+
> - Starting May 2021, the `context.Request.Certificate` property only requests the certificate when the API Management instance's [`hostnameConfiguration`](/rest/api/apimanagement/current-ga/api-management-service/create-or-update#hostnameconfiguration) sets the `negotiateClientCertificate` property to True. By default, `negotiateClientCertificate` is set to False.
99
+
> - If TLS renegotiation is disabled in your client, you might see TLS errors when requesting the certificate using the `context.Request.Certificate` property. If the errors appear, enable TLS renegotiation settings in the client.
100
+
> - Certification renegotiation isn't supported in the API Management v2 tiers.
87
101
88
102
### Checking the issuer and subject
89
103
90
-
Below policies can be configured to check the issuer and subject of a client certificate:
104
+
The following policies can be configured to check the issuer and subject of a client certificate:
91
105
92
106
```xml
93
107
<choose>
@@ -100,13 +114,14 @@ Below policies can be configured to check the issuer and subject of a client cer
100
114
```
101
115
102
116
> [!NOTE]
117
+
>
103
118
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
104
119
>
105
120
> If client certificate is self-signed, root (or intermediate) CA certificates must be [uploaded](api-management-howto-ca-certificates.md) to API Management for `context.Request.Certificate.Verify()` and `context.Request.Certificate.VerifyNoRevocation()` to work.
106
121
107
122
### Checking the thumbprint
108
123
109
-
Below policies can be configured to check the thumbprint of a client certificate:
124
+
The following policies can be configured to check the thumbprint of a client certificate:
110
125
111
126
```xml
112
127
<choose>
@@ -119,7 +134,9 @@ Below policies can be configured to check the thumbprint of a client certificate
119
134
```
120
135
121
136
> [!NOTE]
137
+
>
122
138
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
139
+
>
123
140
> If client certificate is self-signed, root (or intermediate) CA certificates must be [uploaded](api-management-howto-ca-certificates.md) to API Management for `context.Request.Certificate.Verify()` and `context.Request.Certificate.VerifyNoRevocation()` to work.
124
141
125
142
### Checking a thumbprint against certificates uploaded to API Management
@@ -143,9 +160,10 @@ The following example shows how to check the thumbprint of a client certificate
143
160
> If client certificate is self-signed, root (or intermediate) CA certificates must be [uploaded](api-management-howto-ca-certificates.md) to API Management for `context.Request.Certificate.Verify()` and `context.Request.Certificate.VerifyNoRevocation()` to work.
144
161
145
162
> [!TIP]
146
-
> Client certificate deadlock issue described in this [article](https://techcommunity.microsoft.com/t5/Networking-Blog/HTTPS-Client-Certificate-Request-freezes-when-the-Server-is/ba-p/339672) can manifest itself in several ways, for example, requests freeze, requests result in `403 Forbidden` status code after timing out, `context.Request.Certificate` is `null`. This problem usually affects `POST` and `PUT` requests with content length of approximately 60KB or larger.
147
163
>
148
-
> To prevent this issue from occurring, turn on "Negotiate client certificate" setting for desired hostnames for "Custom domains" as shown in the first image of this document. This feature isn't available in the Consumption tier.
164
+
> Client certificate deadlock issue described in this [article](https://techcommunity.microsoft.com/t5/Networking-Blog/HTTPS-Client-Certificate-Request-freezes-when-the-Server-is/ba-p/339672) can manifest itself in several ways. For example, you might see requests freeze, requests result in `403 Forbidden` status code after timing out, or `context.Request.Certificate` is `null`. This problem usually affects `POST` and `PUT` requests with content length of approximately 60KB or larger.
165
+
>
166
+
> To prevent this issue from occurring, turn on **Negotiate client certificate** setting for desired hostnames for **Custom domains** as shown previously in this article. This feature isn't available in the Consumption tier.
Copy file name to clipboardExpand all lines: includes/api-management-key-vault-network.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,22 +11,29 @@ ms.author: danlep
11
11
12
12
If [Key Vault firewall](/azure/key-vault/general/network-security) is enabled on your key vault, you must meet these requirements:
13
13
14
-
* You must use the API Management instance's system-assigned managed identity to access the key vault.
14
+
- You must use the API Management instance's system-assigned managed identity to access the key vault.
15
15
16
-
* In Key Vault firewall, enable the **Allow Trusted Microsoft Services to bypass this firewall** option. API Management supports trusted service connectivity to access the key vault for control-plane options.
16
+
- In Key Vault firewall, enable the **Allow Trusted Microsoft Services to bypass this firewall** option:
17
17
18
-
* Ensure that your local client IP address is allowed to access the key vault temporarily. You must select a certificate or secret to add to Azure API Management. For more information, see [Configure Azure Key Vault networking settings](/azure/key-vault/general/how-to-azure-key-vault-network-security).
18
+
1. In your key vault, select **Settings** > **Networking**.
19
+
1. Under **Firewalls and virtual networks**, select **Allow public access from specific virtual networks and IP addresses**.
20
+
1. Under **Exception**, select **Allow trusted Microsoft services to bypass this firewall**.
19
21
20
-
After completing the configuration, you can block your client address in the key vault firewall.
22
+
API Management supports trusted service connectivity to access the key vault for control-plane options.
23
+
24
+
- Ensure that your local client IP address is allowed to access the key vault temporarily. You must select a certificate or secret to add to Azure API Management. For more information, see [Configure Azure Key Vault networking settings](/azure/key-vault/general/how-to-azure-key-vault-network-security).
25
+
26
+
After you complete the configuration, you can block your client address in the key vault firewall.
21
27
22
28
> [!IMPORTANT]
29
+
>
23
30
> Starting March 2026, trusted service connectivity to Azure services from the API Management gateway by enabling the **Allow Trusted Microsoft Services to bypass this firewall** firewall setting aren't supported. To continue accessing these services from the API Management gateway after this change, ensure that you choose a different supported network access option. For control-plane operations, you can continue to use trusted service connectivity. [Learn more](../articles/api-management/breaking-changes/trusted-service-connectivity-retirement-march-2026.md).
24
31
25
32
#### Virtual network requirements
26
33
27
34
If the API Management instance is deployed in a virtual network, also configure the following network settings:
28
35
29
-
* Enable a [service endpoint](/azure/key-vault/general/overview-vnet-service-endpoints) to Key Vault on the API Management subnet.
30
-
* Configure a network security group (NSG) rule to allow outbound traffic to the `AzureKeyVault` and `AzureActiveDirectory`[service tags](../articles/virtual-network/service-tags-overview.md).
36
+
- Enable a [service endpoint](/azure/key-vault/general/overview-vnet-service-endpoints) to Key Vault on the API Management subnet.
37
+
- Configure a network security group (NSG) rule to allow outbound traffic to the `AzureKeyVault` and `AzureActiveDirectory`[service tags](../articles/virtual-network/service-tags-overview.md).
31
38
32
-
For details, see [Network configuration when setting up API Management in a virtual network](../articles/api-management/virtual-network-reference.md).
39
+
For more information, see [Network configuration when setting up API Management in a virtual network](../articles/api-management/virtual-network-reference.md).
0 commit comments