Skip to content

Commit cf2ace6

Browse files
Merge pull request #291457 from yutanglin16/patch-5
Add info on TLS renegotiation and limits
2 parents 8c0ecf1 + ea49745 commit cf2ace6

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

articles/app-service/app-service-web-configure-tls-mutual-auth.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.custom: devx-track-csharp, devx-track-extended-java, devx-track-js, devx-trac
1212
---
1313
# Configure TLS mutual authentication for Azure App Service
1414

15-
You can restrict access to your Azure App Service app by enabling different types of authentication for it. One way to do it is to request a client certificate when the client request is over TLS/SSL and validate the certificate. This mechanism is called TLS mutual authentication or client certificate authentication. This article shows how to set up your app to use client certificate authentication.
15+
You can restrict access to your Azure App Service app by enabling different types of authentication for it. One way to do it is to request a client certificate when the client request is over TLS/SSL and validate the certificate. This mechanism is called Transport Layer Security (TLS) mutual authentication or client certificate authentication. This article shows how to set up your app to use client certificate authentication.
1616

1717
> [!NOTE]
1818
> Your app code is responsible for validating the client certificate. App Service doesn't do anything with this client certificate other than forwarding it to your app.
@@ -22,27 +22,28 @@ You can restrict access to your Azure App Service app by enabling different type
2222
[!INCLUDE [Prepare your web app](../../includes/app-service-ssl-prepare-app.md)]
2323

2424
## Enable client certificates
25-
26-
To set up your app to require client certificates:
27-
28-
1. From the left navigation of your app's management page, select **Configuration** > **General Settings**.
29-
30-
1. Select **Client certificate mode** of choice. Select **Save** at the top of the page.
25+
When you enable client certificate for your app, you should select your choice of client certificate mode. Each mode defines how your app handles incoming client certificates:
3126

3227
|Client certificate modes|Description|
3328
|-|-|
3429
|Required|All requests require a client certificate.|
35-
|Optional|Requests may or may not use a client certificate. Clients will be prompted for a certificate by default. For example, browser clients will show a prompt to select a certificate for authentication.|
36-
|Optional Interactive User|Requests may or may not use a client certificate. Clients will not be prompted for a certificate by default. For example, browser clients will not show a prompt to select a certificate for authentication.|
30+
|Optional|Requests may or may not use a client certificate and clients are prompted for a certificate by default. For example, browser clients will show a prompt to select a certificate for authentication.|
31+
|Optional Interactive User|Requests may or may not use a client certificate and clients are not prompted for a certificate by default. For example, browser clients won't show a prompt to select a certificate for authentication.|
32+
33+
### [Azure portal](#tab/azureportal)
34+
To set up your app to require client certificates in Azure portal:
35+
1. Navigate to your app's management page.
36+
1. From the left navigation of your app's management page, select **Configuration** > **General Settings**.
37+
1. Select **Client certificate mode** of choice. Select **Save** at the top of the page.
3738

3839
### [Azure CLI](#tab/azurecli)
39-
To do the same with Azure CLI, run the following command in the [Cloud Shell](https://shell.azure.com):
40+
With Azure CLI, run the following command in the [Cloud Shell](https://shell.azure.com):
4041

4142
```azurecli-interactive
4243
az webapp update --set clientCertEnabled=true --name <app-name> --resource-group <group-name>
4344
```
44-
### [Bicep](#tab/bicep)
4545

46+
### [Bicep](#tab/bicep)
4647
For Bicep, modify the properties `clientCertEnabled`, `clientCertMode`, and `clientCertExclusionPaths`. A sample Bicep snippet is provided for you:
4748

4849
```bicep
@@ -63,7 +64,6 @@ resource appService 'Microsoft.Web/sites@2020-06-01' = {
6364
```
6465

6566
### [ARM template](#tab/arm)
66-
6767
For ARM templates, modify the properties `clientCertEnabled`, `clientCertMode`, and `clientCertExclusionPaths`. A sample ARM template snippet is provided for you:
6868

6969
```ARM
@@ -93,6 +93,9 @@ For ARM templates, modify the properties `clientCertEnabled`, `clientCertMode`,
9393

9494
When you enable mutual auth for your application, all paths under the root of your app require a client certificate for access. To remove this requirement for certain paths, define exclusion paths as part of your application configuration.
9595

96+
> [!NOTE]
97+
> Using any client certificate exclusion path triggers TLS renegotiation for incoming requests to the app.
98+
9699
1. From the left navigation of your app's management page, select **Configuration** > **General Settings**.
97100

98101
1. Next to **Certificate exclusion paths**, select the edit icon.
@@ -105,6 +108,29 @@ In the following screenshot, any path for your app that starts with `/public` do
105108

106109
![Certificate Exclusion Paths][exclusion-paths]
107110

111+
## Client certificate and TLS renegotiation
112+
App Service requires TLS renegotiation to read a request before knowing whether to prompt for a client certificate. Any of the following settings triggers TLS renegotiation:
113+
1. Using "Optional Interactive User" client certificate mode.
114+
1. Using [client certificate exclusion path](#exclude-paths-from-requiring-authentication).
115+
116+
> [!NOTE]
117+
> TLS 1.3 and HTTP 2.0 don't support TLS renegotiation. These protocols will not work if your app is configured with client certificate settings that use TLS renegotiation.
118+
119+
To disable TLS renegotiation and to have the app negotiate client certificates during TLS handshake, you must configure your app with *all* these settings:
120+
1. Set client certificate mode to "Required" or "Optional"
121+
2. Remove all client certificate exclusion paths
122+
123+
### Uploading large files with TLS renegotiation
124+
Client certificate configurations that use TLS renegotiation cannot support incoming requests with large files greater than 100 kb due to buffer size limitations. In this scenario, any POST or PUT requests over 100 kb will fail with a 403 error. This limit isn't configurable and can't be increased.
125+
126+
To address the 100 kb limit, consider these alternative solutions:
127+
128+
1. Update your app's client certificate configurations with _all_ these settings:
129+
- Set client certificate mode to either "Required" or "Optional"
130+
- Remove all client certificate exclusion paths
131+
1. Send a HEAD request before the PUT/POST request. The HEAD request handles the client certificate.
132+
1. Add the header `Expect: 100-Continue` to your request. This causes the client to wait until the server responds with a `100 Continue` before sending the request body, which bypasses the buffers.
133+
108134
## Access client certificate
109135

110136
In App Service, TLS termination of the request happens at the frontend load balancer. When App Service forwards the request to your app code with [client certificates enabled](#enable-client-certificates), it injects an `X-ARR-ClientCert` request header with the client certificate. App Service doesn't do anything with this client certificate other than forwarding it to your app. Your app code is responsible for validating the client certificate.

0 commit comments

Comments
 (0)