Skip to content

Commit 56306eb

Browse files
authored
Merge pull request #311025 from TimShererWithAquent/us543933-02
Freshness Edit: Azure API Management: How to secure APIs using client certificate authentication in API Management
2 parents b94c657 + 2af2c40 commit 56306eb

6 files changed

Lines changed: 88 additions & 60 deletions

File tree

articles/api-management/api-management-howto-mutual-certificates-for-clients.md

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ titleSuffix: Azure API Management
44
description: Learn how to secure access to APIs by using client certificates. You can use policy expressions to validate incoming certificates.
55
services: api-management
66
author: dlepow
7-
87
ms.service: azure-api-management
98
ms.topic: how-to
10-
ms.date: 10/30/2024
9+
ms.date: 01/29/2026
1110
ms.author: danlep
1211
ms.custom:
1312
- engagement-fy23
1413
- 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.
1515
---
1616

1717
# How to secure APIs using client certificate authentication in API Management
@@ -20,52 +20,62 @@ ms.custom:
2020

2121
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.
2222

23-
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).
23+
For information about securing access to the backend service of an API using client certificates or API Management to backend, see [Secure backend services](./api-management-howto-mutual-certificates.md).
2424

25-
For a conceptual overview of API authorization, see [Authentication and authorization to APIs in API Management](authentication-authorization-overview.md).
25+
For a conceptual overview of API authorization, see [Authentication and authorization](authentication-authorization-overview.md).
2626

2727
## Certificate options
2828

2929
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:
3030

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
3333

3434
[!INCLUDE [api-management-workspace-key-vault-availability](../../includes/api-management-workspace-key-vault-availability.md)]
3535

36-
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:
3737

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.
4141

4242
## Prerequisites
4343

44-
* If you have not 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.
4646

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.
4848

49-
> [!NOTE]
50-
> CA certificates for certificate validation are not supported in the Consumption tier.
49+
> [!NOTE]
50+
>
51+
> CA certificates for certificate validation aren't supported in the Consumption tier.
5152
5253
[!INCLUDE [api-management-client-certificate-key-vault](../../includes/api-management-client-certificate-key-vault.md)]
5354

5455
> [!NOTE]
55-
> 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.
5658
5759
## Enable API Management instance to receive and verify client certificates
5860

5961
### Developer, Basic, Standard, or Premium tier
6062

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 on the **Custom domain** blade as shown below.
63+
To receive and verify client certificates over HTTP/2 in the Developer, Basic, Standard, or Premium tiers, you must enable **Negotiate client certificate**.
64+
65+
1. Select **Deployment + infrastructure**, then **Custom domains**.
66+
1. Select the gateway hostname.
67+
1. In the **Gateway** page, select **Negotiate client certificate**, then **Update**.
6268

63-
![Negotiate client certificate](./media/api-management-howto-mutual-certificates-for-clients/negotiate-client-certificate.png)
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.":::
6470

6571
### 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 on the **Custom domains** blade as shown below.
6772

68-
![Request client certificate](./media/api-management-howto-mutual-certificates-for-clients/request-client-certificate.png)
73+
To receive and verify client certificates in the Consumption, Basic v2, Standard v2, or Premium v2 tier, you must enable **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.":::
6979

7080
## Policy to validate client certificates
7181

@@ -78,16 +88,20 @@ Configure the policy to validate one or more attributes including certificate is
7888
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.
7989

8090
> [!NOTE]
81-
> Mutual certificate authentication might not function correctly when the API Management gateway endpoint is exposed through the Application Gateway. This is because Application Gateway functions as a Layer 7 load balancer, establishing a distinct SSL connection with the backend API Management service. Consequently, the certificate attached by the client in the initial HTTP request will not be 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).
8295
8396
> [!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 may see TLS errors when requesting the certificate using the `context.Request.Certificate` property. If this occurs, enable TLS renegotiation settings in the client.
86-
> * Certification renegotiation is not 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+
> - Certificate renegotiation isn't supported in the API Management v2 tiers.
87101
88102
### Checking the issuer and subject
89103

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:
91105

92106
```xml
93107
<choose>
@@ -100,12 +114,14 @@ Below policies can be configured to check the issuer and subject of a client cer
100114
```
101115

102116
> [!NOTE]
117+
>
103118
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
104-
> 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.
119+
>
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.
105121
106122
### Checking the thumbprint
107123

108-
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:
109125

110126
```xml
111127
<choose>
@@ -118,8 +134,10 @@ Below policies can be configured to check the thumbprint of a client certificate
118134
```
119135

120136
> [!NOTE]
137+
>
121138
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
122-
> 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.
139+
>
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.
123141
124142
### Checking a thumbprint against certificates uploaded to API Management
125143

@@ -138,14 +156,17 @@ The following example shows how to check the thumbprint of a client certificate
138156

139157
> [!NOTE]
140158
> To disable checking certificate revocation list, use `context.Request.Certificate.VerifyNoRevocation()` instead of `context.Request.Certificate.Verify()`.
141-
> 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.
159+
>
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.
142161
143162
> [!TIP]
144-
> 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, e.g. 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.
145-
> To prevent this issue from occurring turn on "Negotiate client certificate" setting for desired hostnames on the "Custom domains" blade as shown in the first image of this document. This feature is not available in the Consumption tier.
163+
>
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.
146167
147168
## Related content
148169

149-
- [How to secure backend services using client certificate authentication](./api-management-howto-mutual-certificates.md)
150-
- [How to add a custom CA certificate in Azure API Management](./api-management-howto-ca-certificates.md)
151-
- Learn about [policies in API Management](api-management-howto-policies.md)
170+
- [Secure backend services in Azure API Management](./api-management-howto-mutual-certificates.md)
171+
- [How to add a custom CA certificate in Azure API Management](./api-management-howto-ca-certificates.md)
172+
- [Policies in Azure API Management](api-management-howto-policies.md)
-124 KB
Loading
-93.4 KB
Loading

includes/api-management-client-certificate-key-vault.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
author: dlepow
33
ms.service: azure-api-management
44
ms.topic: include
5-
ms.date: 01/11/2023
5+
ms.date: 01/29/2026
66
ms.author: danlep
77
ms.custom: sfi-image-nochange
88
---
99

1010
### Prerequisites for key vault integration
1111

12-
1. If you don't already have a key vault, create one. For information about creating a key vault, see [Quickstart: Create a key vault using the Azure portal](/azure/key-vault/general/quick-create-portal).
13-
12+
- If you don't already have a key vault, create one. For information about creating a key vault, see [Quickstart: Create a key vault using the Azure portal](/azure/key-vault/general/quick-create-portal).
1413

15-
1. Enable a system-assigned or user-assigned [managed identity](../articles/api-management/api-management-howto-use-managed-service-identity.md) in API Management.
14+
- Enable a system-assigned or user-assigned [managed identity](../articles/api-management/api-management-howto-use-managed-service-identity.md) in API Management.
1615

1716
[!INCLUDE [api-management-key-vault-access](./api-management-key-vault-access.md)]
1817

@@ -34,18 +33,24 @@ To add a key vault certificate to API Management:
3433

3534
1. In the [Azure portal](https://portal.azure.com), go to your API Management instance.
3635
1. Under **Security**, select **Certificates**.
37-
1. Select **Certificates** > **+ Add**.
36+
1. Select **Certificates**, then **+ Add**.
3837
1. In **Id**, enter a name.
3938
1. In **Certificate**, select **Key vault**.
4039
1. Enter the identifier of a key vault certificate, or choose **Select** to select a certificate from a key vault.
41-
> [!IMPORTANT]
42-
> If you enter a key vault certificate identifier yourself, be sure that it doesn't have version information. Otherwise, the certificate won't rotate automatically in API Management after an update in the key vault.
40+
41+
> [!IMPORTANT]
42+
>
43+
> If you enter a key vault certificate identifier yourself, be sure that it doesn't have version information. Otherwise, the certificate won't rotate automatically in API Management after an update in the key vault.
44+
4345
1. In **Client identity**, select a system-assigned identity or an existing user-assigned managed identity. For more information, see [Use managed identities in Azure API Management](../articles/api-management/api-management-howto-use-managed-service-identity.md).
44-
> [!NOTE]
45-
> The identity needs to have permissions to get and list certificates from the key vault. If you haven't already configured access to the key vault, API Management prompts you so that it can automatically configure the identity with the necessary permissions.
46+
47+
> [!NOTE]
48+
>
49+
> The identity needs to have permissions to get and list certificates from the key vault. If you haven't already configured access to the key vault, API Management prompts you so that it can automatically configure the identity with the necessary permissions.
50+
4651
1. Select **Add**.
4752

48-
:::image type="content" source="../articles/api-management/media/api-management-howto-mutual-certificates/apim-client-cert-kv.png" alt-text="Screenshot that shows how to add a key vault certificate to API Management in the portal." lightbox="../articles/api-management/media/api-management-howto-mutual-certificates/apim-client-cert-kv.png":::
53+
:::image type="content" source="../articles/api-management/media/api-management-howto-mutual-certificates/apim-client-cert-kv.png" alt-text="Screenshot that shows how to add a key vault certificate to API Management in the portal." lightbox="../articles/api-management/media/api-management-howto-mutual-certificates/apim-client-cert-kv.png":::
4954

5055
1. Select **Save**.
5156

@@ -55,13 +60,12 @@ To upload a client certificate to API Management:
5560

5661
1. In the [Azure portal](https://portal.azure.com), go to your API Management instance.
5762
1. Under **Security**, select **Certificates**.
58-
1. Select **Certificates** > **+ Add**.
63+
1. Select **Certificates**, then **+ Add**.
5964
1. In **Id**, enter a name.
6065
1. In **Certificate**, select **Custom**.
6166
1. Browse to select the certificate .pfx file, and enter its password.
6267
1. Select **Add**.
6368

64-
:::image type="content" source="../articles/api-management/media/api-management-howto-mutual-certificates/apim-client-cert-add.png" alt-text="Screenshot of uploading a client certificate to API Management in the portal.":::
65-
69+
:::image type="content" source="../articles/api-management/media/api-management-howto-mutual-certificates/apim-client-cert-add.png" alt-text="Screenshot of uploading a client certificate to API Management in the portal.":::
6670

6771
1. Select **Save**.

0 commit comments

Comments
 (0)