Skip to content

Commit 1c36ef0

Browse files
authored
Merge pull request #268658 from craigshoemaker/aca/certificate-updates
[Container Apps] New: Key Vault certificates (overview & how-to)
2 parents 93fa4dc + c2d77f7 commit 1c36ef0

File tree

3 files changed

+131
-8
lines changed

3 files changed

+131
-8
lines changed

articles/container-apps/TOC.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,15 @@
164164
items:
165165
- name: Overview
166166
href: certificates-overview.md
167-
- name: Set up custom domain with a free certificate
167+
- name: Custom domain with a free certificate
168168
href: custom-domains-managed-certificates.md
169169
displayName: Set up custom domain with a managed certificate
170170
- name: Set up custom domain with existing certificate
171171
href: custom-domains-certificates.md
172172
- name: Set up environment custom DNS suffix
173173
href: environment-custom-dns-suffix.md
174-
174+
- name: Certificates from Key Vault
175+
href: key-vault-certificates-manage.md
175176
- name: Authentication
176177
items:
177178
- name: Overview

articles/container-apps/certificates-overview.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: container-apps
55
author: craigshoemaker
66
ms.service: container-apps
77
ms.topic: conceptual
8-
ms.date: 03/28/2024
8+
ms.date: 04/15/2024
99
ms.author: cshoe
1010
---
1111

@@ -15,15 +15,15 @@ You can add digital security certificates to secure custom DNS names in Azure Co
1515

1616
## Options
1717

18-
The following table lists the options available to add certificates in Container Apps:
18+
The following table lists the options available to manage certificates in Container Apps:
1919

2020
| Option | Description |
2121
|---|---|
22-
| [Create a free Azure Container Apps managed certificate](./custom-domains-managed-certificates.md) | A private certificate that's free of charge and easy to use if you just need to secure your custom domain in Container Apps. |
23-
| Import a certificate from Key Vault | Useful if you use [Azure Key Vault](../key-vault/index.yml) to manage your [PKCS12 certificates](https://wikipedia.org/wiki/PKCS_12). |
24-
| [Upload a private certificate](./custom-domains-certificates.md) | You can upload a private certificate if you already have one. |
22+
| [Custom domain with a free certificate](./custom-domains-managed-certificates.md) | A private certificate that's free of charge and easy to use if you just need to secure your custom domain in Container Apps. |
23+
| [Custom domain with an existing certificate](./custom-domains-certificates.md) | You can upload a private certificate if you already have one. |
24+
| [Certificates from Azure Key Vault](./key-vault-certificates-manage.md) | When you use Azure Key Vault, you get features like automatic renewal and notifications for lifecycle events. |
2525

2626
## Next steps
2727

2828
> [!div class="nextstepaction"]
29-
> [Set up custom domain with existing certificate](custom-domains-certificates.md)
29+
> [Custom domain names and free managed certificates](custom-domains-managed-certificates.md)
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: Import certificates from Azure Key Vault to Azure Container Apps
3+
description: Learn to managing secure certificates in Azure Container Apps.
4+
services: container-apps
5+
author: craigshoemaker
6+
ms.service: container-apps
7+
ms.topic: how-to
8+
ms.date: 05/09/2024
9+
ms.author: cshoe
10+
---
11+
12+
# Import certificates from Azure Key Vault to Azure Container Apps (preview)
13+
14+
You can set up Azure Key Vault to manage your container app's certificates to handle updates, renewals, and monitoring. Without Key Vault, you're left managing your certificate manually, which means you can't manage certificates in a central location and can't take advantage of lifecycle automation or notifications.
15+
16+
## Prerequisites
17+
18+
- [Azure Key Vault](/azure/key-vault/general/manage-with-cli2): Create a Key Vault resource.
19+
20+
- [Azure CLI](/cli/azure/install-azure-cli): You need the Azure CLI updated with the Azure Container Apps extension version `0.3.49` or higher. Use the `az extension add` command to install the latest version.
21+
22+
```azurecli
23+
az extension add --name containerapp --upgrade --allow-preview`
24+
```
25+
26+
- [Managed identity](./managed-identity.md): Enable managed identity on your Container Apps environment.
27+
28+
## Secret configuration
29+
30+
An [Azure Key Vault](/azure/key-vault/general/manage-with-cli2) instance is required to store your certificate. Make the following updates to your Key Vault instance:
31+
32+
1. Open the [Azure portal](https://portal.azure.com).
33+
34+
1. Go to your Azure Container Apps environment.
35+
36+
1. From *Settings*, select Access control (IAM).
37+
38+
1. From the *Roles* tab, and set yourself as a *Key Vault Administrator*.
39+
40+
1. Go to your certificate's details and copy the value for *Secret Identifier* and paste it into a text editor for use in an upcoming step.
41+
42+
> [!NOTE]
43+
> To retrieve a specific version of the certificate, include the version suffix with the secret identifier. To get the latest version, remove the version suffix from the identifier.
44+
45+
## Enable and configure Key Vault Certificate
46+
47+
1. Open the Azure portal and go to your Key Vault.
48+
49+
1. In the *Objects* section, select **Certificates**.
50+
51+
1. Select the certificate you want to use.
52+
53+
1. In the *Access control (IAM)* section, select **Add role assignment**.
54+
55+
1. Add the roles: **Key Vault Certificates Officer** and **Key Vault Secrets Officer**.
56+
57+
1. Go to your certificate's details and copy the value for **Secret Identifier**.
58+
59+
1. Paste the identifier into a text editor for use in an upcoming step.
60+
61+
## Assign roles for environment-level managed identity
62+
63+
1. Open the [Azure portal](https://portal.azure.com) and find your instance of your Azure Container Apps environment where you want to import a certificate.
64+
65+
1. From *Settings*, select **Identity**.
66+
67+
1. On the *System assigned* tab, find the *Status* switch and select **On**.
68+
69+
1. Select **Save**, and when the *Enable system assigned managed identity* window appears, select **Yes**.
70+
71+
1. Under the *Permissions* label, select **Azure role assignments** to open the role assignments window.
72+
73+
1. Select **Add role assignment** and enter the following values:
74+
75+
| Property | Value |
76+
|--|--|
77+
| Scope | Select **Key Vault**. |
78+
| Subscription | Select your Azure subscription. |
79+
| Resource | Select your vault. |
80+
| Role | Select *Key Vault Secrets User**. |
81+
82+
1. Select **Save**.
83+
84+
For more detail on RBAC vs. legacy access policies, see [Azure role-based access control (Azure RBAC) vs. access policies](/azure/key-vault/general/rbac-access-policy).
85+
86+
## Import a certificate
87+
88+
Once you authorize your container app to read the vault, you can use the `az containerapp env certificate upload` command to import your vault to your Container Apps environment.
89+
90+
Before you run the following command, replace the placeholder tokens surrounded by `<>` brackets with your own values.
91+
92+
```azurecli
93+
az containerapp env certificate upload \
94+
--resource-group <RESOURCE_GROUP> \
95+
--name <CONTAINER_APP_NAME> \
96+
--akv-url <KEY_VAULT_URL> \
97+
--certificate-identity <CERTIFICATE_IDENTITY>
98+
```
99+
100+
For more information regarding the command parameters, see the following table.
101+
102+
| Parameter | Description |
103+
|---|---|
104+
| `--resource-group` | Your resource group name. |
105+
| `--name` | Your container app name. |
106+
| `--akv-url` | The URL for your secret identifier. This URL is the value you set aside in a previous step. |
107+
| `--certificate-identity` | The ID for your managed identity. This value can either be `system`, or the ID for your user-assigned managed identity. |
108+
109+
## Troubleshooting
110+
111+
If you encounter an error message as you import your certificate, verify your actions using the following steps:
112+
113+
- Ensure that permissions are correctly configured for both your certificate and environment-level managed identity.
114+
115+
- You should assign both *Key Vault Secrets Officer* and *Key Vault Certificates Officer* roles.
116+
117+
- Make sure that you're using the correct URL for accessing your certificate. You should be using the *Secret Identifier* URL.
118+
119+
## Related
120+
121+
> [!div class="nextstepaction"]
122+
> [Manage secrets](manage-secrets.md)

0 commit comments

Comments
 (0)