Skip to content

Commit 32edfdc

Browse files
authored
Merge pull request #223997 from MicrosoftDocs/main
Publish to live, Sunday 4 AM PST, 1/15
2 parents b0d1820 + 7930dbf commit 32edfdc

36 files changed

+461
-368
lines changed

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

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,57 @@ description: Learn how to secure access to APIs by using client certificates. Yo
55
services: api-management
66
documentationcenter: ''
77
author: dlepow
8-
manager: erikre
9-
editor: ''
108

119
ms.service: api-management
12-
ms.workload: mobile
13-
ms.tgt_pltfrm: na
1410
ms.topic: article
15-
ms.date: 06/01/2021
11+
ms.date: 01/12/2023
1612
ms.author: danlep
13+
ms.custom: engagement-fy23
1714
---
1815

1916
# How to secure APIs using client certificate authentication in API Management
2017

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

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).
2421

2522
For a conceptual overview of API authorization, see [Authentication and authorization in API Management](authentication-authorization-overview.md#gateway-data-plane).
2623

24+
## Certificate options
2725

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.
46+
47+
[!INCLUDE [api-management-client-certificate-key-vault](../../includes/api-management-client-certificate-key-vault.md)]
48+
49+
## 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.
3054

3155
![Negotiate client certificate](./media/api-management-howto-mutual-certificates-for-clients/negotiate-client-certificate.png)
3256

33-
> [!IMPORTANT]
34-
> 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.
3559

3660
![Request client certificate](./media/api-management-howto-mutual-certificates-for-clients/request-client-certificate.png)
3761

@@ -41,8 +65,6 @@ Use the [validate-client-certificate](validate-client-certificate-policy.md) pol
4165

4266
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.
4367

44-
For more information, see [API Management access restriction policies](api-management-access-restriction-policies.md).
45-
4668
## Certificate validation with context variables
4769

4870
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
6688
```
6789

6890
> [!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()`.
7092
> 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.
7193
7294
### Checking the thumbprint
@@ -84,7 +106,7 @@ Below policies can be configured to check the thumbprint of a client certificate
84106
```
85107

86108
> [!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()`.
88110
> 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.
89111
90112
### 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
103125
```
104126

105127
> [!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()`.
107129
> 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.
108130
109131
> [!TIP]
@@ -112,5 +134,6 @@ The following example shows how to check the thumbprint of a client certificate
112134
113135
## Next steps
114136

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)

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

Lines changed: 13 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ author: dlepow
88

99
ms.service: api-management
1010
ms.topic: article
11-
ms.date: 01/26/2021
11+
ms.date: 01/12/2023
1212
ms.author: danlep
13-
ms.custom: devx-track-azurepowershell
13+
ms.custom: devx-track-azurepowershell, engagement-fy23
1414
---
1515

1616
# Secure backend services using client certificate authentication in Azure API Management
1717

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

2020
You can also manage API Management certificates using the [API Management REST API](/rest/api/apimanagement/current-ga/certificate).
2121

@@ -36,73 +36,21 @@ Using key vault certificates is recommended because it helps improve API Managem
3636

3737
[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)]
3838

39-
* If you have not created an API Management service instance yet, see [Create an API Management service instance][Create an API Management service instance].
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).
4040
* 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.
4242

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:
48-
1. In the portal, navigate to your key vault.
49-
1. Select **Settings > Access policies > + Add Access Policy**.
50-
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.
54-
55-
[!INCLUDE [api-management-key-vault-network](../../includes/api-management-key-vault-network.md)]
56-
57-
## Add a key vault certificate
58-
59-
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.
77-
1. Select **Add**.
78-
79-
80-
81-
:::image type="content" source="media/api-management-howto-mutual-certificates/apim-client-cert-kv.png" alt-text="Add key vault certificate":::
43+
If you use a self-signed certificate:
44+
* Install trusted root and intermediate [CA certificates](api-management-howto-ca-certificates.md) in your API Management instance.
8245

83-
1. Select **Save**.
84-
85-
## Upload a certificate
86-
87-
To upload a client certificate to API Management:
46+
> [!NOTE]
47+
> CA certificates for certificate validation are not supported in the Consumption tier.
48+
* [Disable certificate chain validation](#disable-certificate-chain-validation-for-self-signed-certificates)
8849

89-
1. In the [Azure portal](https://portal.azure.com), navigate to your API Management instance.
90-
1. Under **Security**, select **Certificates**.
91-
1. Select **Certificates** > **+ Add**.
92-
1. In **Id**, enter a name of your choice.
93-
1. In **Certificate**, select **Custom**.
94-
1. Browse to select the certificate .pfx file, and enter its password.
95-
1. Select **Add**.
96-
97-
:::image type="content" source="media/api-management-howto-mutual-certificates/apim-client-cert-add.png" alt-text="Upload client certificate":::
98-
99-
100-
1. Select **Save**.
50+
[!INCLUDE [api-management-client-certificate-key-vault](../../includes/api-management-client-certificate-key-vault.md)]
10151

10252
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).
10353

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

10755
## Configure an API to use client certificate for gateway authentication
10856

@@ -121,7 +69,7 @@ After the certificate is uploaded, it shows in the **Certificates** window. If y
12169
> [!TIP]
12270
> 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.
12371
124-
## Self-signed certificates
72+
## Disable certificate chain validation for self-signed certificates
12573

12674
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`.
12775

@@ -144,6 +92,7 @@ To delete a certificate, select it and then select **Delete** from the context m
14492
## Next steps
14593

14694
* [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)
14796
* Learn about [policies in API Management](api-management-howto-policies.md)
14897

14998

0 commit comments

Comments
 (0)