Skip to content

Commit 640f8e8

Browse files
Updated the article to address the issue, extenced the documentation to "format the certificate gets forwarded to the app running in ACA container".
1 parent 181f8d4 commit 640f8e8

File tree

1 file changed

+51
-4
lines changed

1 file changed

+51
-4
lines changed

articles/container-apps/client-certificate-authorization.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ services: container-apps
55
author: craigshoemaker
66
ms.service: azure-container-apps
77
ms.topic: how-to
8-
ms.date: 06/13/2024
8+
ms.date: 04/01/2025
99
ms.author: cshoe
1010
---
1111

1212
# Configure client certificate authentication in Azure Container Apps
1313

1414
Azure Container Apps supports client certificate authentication (also known as mutual TLS or mTLS) that allows access to your container app through two-way authentication. This article shows you how to configure client certificate authorization in Azure Container Apps.
1515

16-
When client certificates are used, the TLS certificates are exchanged between the client and your container app to authenticate identity and encrypt traffic. Client certificates are often used in "zero trust" security models to authorize client access within an organization.
16+
When client certificates are used, the TLS certificates are exchanged between the client and your container app to authenticate identity and encrypt traffic. Client certificates are often used in "Zero Trust" security models to authorize client access within an organization.
1717

1818
For example, you might want to require a client certificate for a container app that manages sensitive data.
1919

@@ -34,16 +34,63 @@ Ingress passes the client certificate to the container app if `require` or `acce
3434
The following ARM template example configures ingress to require a client certificate for all requests to the container app.
3535

3636
```json
37-
{
37+
{
3838
"properties": {
3939
"configuration": {
4040
"ingress": {
41-
"clientCertificateMode": "require"
41+
"clientCertificateMode": "require | accept | ignore"
4242
}
4343
}
4444
}
4545
}
4646
```
47+
> [!NOTE]
48+
> You can set the `clientCertificateMode` directly on the ingress property. It isn't yet available as an explicit option in the CLI, but you can patch your app using the Azure CLI.
49+
50+
Get the ARM ID of the Azure Container App:
51+
52+
```azurecli
53+
APP_ID=$(az containerapp show \
54+
--name <app-name> \
55+
--resource-group <resource-group> \
56+
--query id \
57+
--output tsv)
58+
```
59+
60+
Patch the clientCertificateMode Property on the App:
61+
62+
```azurecli
63+
az rest \
64+
--method patch \
65+
--url "https://management.azure.com/$APP_ID?api-version=<api-version>" \
66+
--body '{
67+
"properties": {
68+
"configuration": {
69+
"ingress": {
70+
"clientCertificateMode": "require"
71+
}
72+
}
73+
}
74+
}'
75+
```
76+
When `require` is set, the client must provide a certificate.
77+
When `accept` is set, the certificate is optional. If the client provides a certificate, it is passed to the app in the X-Forwarded-Client-Cert header, as a semicolon-separated list. For example:
78+
79+
```html
80+
<button style="margin: 0px;">
81+
</button>
82+
83+
<script>
84+
const hash = '....';
85+
const cert = `-----BEGIN CERTIFICATE-----
86+
....
87+
-----END CERTIFICATE-----`;
88+
89+
const chain = `-----BEGIN CERTIFICATE-----
90+
...
91+
-----END CERTIFICATE-----`;
92+
</script>
93+
```
4794

4895
## Next Steps
4996

0 commit comments

Comments
 (0)