You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/key-vault-certificates-manage.md
+38-70Lines changed: 38 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,62 +5,23 @@ services: container-apps
5
5
author: craigshoemaker
6
6
ms.service: azure-container-apps
7
7
ms.topic: how-to
8
-
ms.date: 05/09/2024
8
+
ms.date: 08/14/2024
9
9
ms.author: cshoe
10
10
---
11
11
12
-
# Import certificates from Azure Key Vault to Azure Container Apps (preview)
12
+
# Import certificates from Azure Key Vault to Azure Container Apps
13
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.
14
+
You can set up Azure Key Vault to centrally manage your container app's TLS/SSL certificates and handle updates, renewals, and monitoring.
15
15
16
16
## Prerequisites
17
17
18
-
-[Azure Key Vault](/azure/key-vault/general/manage-with-cli2): Create a Key Vault resource.
18
+
An Azure Key Vault resource is required to store your certificate. See [Import a certificate in Azure Key Vault](/azure/key-vault/certificates/tutorial-import-certificate?tabs=azure-portal) or [Configure certificate auto-rotation in Key Vault](/azure/key-vault/certificates/tutorial-rotate-certificates) to create a Key Vault and add a certificate.
19
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.
20
+
## Enable managed identity for Container Apps environment
21
21
22
-
```azurecli
23
-
az extension add --name containerapp --upgrade --allow-preview`
24
-
```
22
+
Azure Container Apps uses an environment level managed identity to access your Key Vault and import your certificate. To enable system-assigned managed identity, follow these steps:
25
23
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.
24
+
1. Open the [Azure portal](https://portal.azure.com) and find your Azure Container Apps environment where you want to import a certificate.
64
25
65
26
1. From *Settings*, select **Identity**.
66
27
@@ -77,46 +38,53 @@ An [Azure Key Vault](/azure/key-vault/general/manage-with-cli2) instance is requ
77
38
| Scope | Select **Key Vault**. |
78
39
| Subscription | Select your Azure subscription. |
79
40
| Resource | Select your vault. |
80
-
| Role | Select *Key Vault Secrets User**. |
41
+
| Role | Select **Key Vault Secrets User**. |
81
42
82
43
1. Select **Save**.
83
44
84
45
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
46
86
-
## Import a certificate
47
+
## Import certificate from Key Vault
48
+
49
+
1. Open the Azure portal and go to your Azure Container Apps environment.
50
+
51
+
1. From *Settings*, select **Certificates**.
52
+
53
+
1. Select the **Bring your own certificates (.pfx)** tab.
87
54
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.
55
+
1. Select **Add certificate**.
89
56
90
-
Before you run the following command, replace the placeholder tokens surrounded by `<>` brackets with your own values.
57
+
1. In the *Add certificate* panel, in *Source*, select **Import from Key Vault**.
58
+
59
+
1. Select **Select key vault certificate** and select the following values:
60
+
61
+
| Property | Value |
62
+
|--|--|
63
+
| Subscription | Select your Azure subscription. |
64
+
| Key vault | Select your vault. |
65
+
| Certificate | Select your certificate. |
66
+
67
+
> [!NOTE]
68
+
> If you see an error, *"The operation "List" is not enabled in this key vault's access policy."*, you need to configure an access policy in your Key Vault to allow your user account to list certificates. For more information, see [Assign a Key Vault access policy](/azure/key-vault/general/assign-access-policy?tabs=azure-portal).
91
69
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
-
```
70
+
1. Select **Select**.
99
71
100
-
For more information regarding the command parameters, see the following table.
72
+
1. In the *Add certificate* panel, in *Managed identity*, select **System assigned**. If you're using a user-assigned managed identity, select your user-assigned managed identity.
101
73
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. |
74
+
1. Select **Add**.
108
75
109
-
## Troubleshooting
76
+
> [!NOTE]
77
+
> If you receive an error message, verify that the managed identity is assigned the **Key Vault Secrets User** role on the Key Vault.
110
78
111
-
If you encounter an error message as you import your certificate, verify your actions using the following steps:
79
+
## Configure a custom domain
112
80
113
-
- Ensure that permissions are correctly configured for both your certificate and environment-level managed identity.
81
+
After configuring your certificate, you can use it to secure your custom domain. Follow the steps in [Add a custom domain](custom-domains-certificates.md#add-a-custom-domain-and-certificate) and select the certificate you imported from Key Vault.
114
82
115
-
- You should assign both *Key Vault Secrets Officer* and *Key Vault Certificates Officer* roles.
83
+
## Rotate certificates
116
84
117
-
- Make sure that you're using the correct URL for accessing your certificate. You should be using the *Secret Identifier* URL.
85
+
When you rotate your certificate in Key Vault, Azure Container Apps automatically updates the certificate in your environment. It takes up to 12 hours for the new certificate to be applied.
118
86
119
87
## Related
120
88
121
89
> [!div class="nextstepaction"]
122
-
> [Manage secrets](manage-secrets.md)
90
+
> [Certificates in Azure Container Apps](certificates-overview.md)
0 commit comments