Skip to content

Commit 0c96e9e

Browse files
committed
[ACA] Recommend storing secrets in Key Vault.
1 parent abbed05 commit 0c96e9e

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

articles/container-apps/code/secure-app-arm-template.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"secrets": [
2828
{
2929
"name": "queue-connection-string",
30-
"value": "[parameters('queue-connection-string')]"
30+
"keyVaultUrl": "[parameters('key_vault_secret_uri')",
31+
"identity": "system"
3132
}]
3233
},
3334
"template": {

articles/container-apps/get-started-existing-container-image.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: craigshoemaker
66
ms.service: azure-container-apps
77
ms.custom: devx-track-azurecli, devx-track-azurepowershell
88
ms.topic: quickstart
9-
ms.date: 08/31/2022
9+
ms.date: 09/12/2024
1010
ms.author: cshoe
1111
zone_pivot_groups: container-apps-registry-types
1212
---

articles/container-apps/manage-secrets.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: container-apps
55
author: craigshoemaker
66
ms.service: azure-container-apps
77
ms.topic: how-to
8-
ms.date: 03/23/2023
8+
ms.date: 09/18/2024
99
ms.author: cshoe
1010
ms.custom: devx-track-azurecli, devx-track-azurepowershell, build-2023
1111
---
@@ -30,6 +30,9 @@ Before you delete a secret, deploy a new revision that no longer references the
3030

3131
Secrets are defined as a set of name/value pairs. The value of each secret is specified directly or as a reference to a secret stored in Azure Key Vault.
3232

33+
> [!NOTE]
34+
> You should not specify the value of a secret directly in a production environment. Instead, use a reference to a secret stored in Azure Key Vault, as described in the [next section](#reference-secret-from-key-vault).
35+
3336
### Store secret value in Container Apps
3437

3538
When you define secrets through the portal, or via different command line options.
@@ -252,7 +255,7 @@ After you've [defined a secret](#defining-secrets) in your container app, you ca
252255

253256
In this example, the application connection string is declared as `queue-connection-string` and becomes available elsewhere in the configuration sections.
254257

255-
:::code language="json" source="code/secure-app-arm-template.json" highlight="11,12,13,27,28,29,30,31,44,45,61,62":::
258+
:::code language="json" source="code/secure-app-arm-template.json" highlight="11-13,27-32,45-46,62-63":::
256259

257260
Here, the environment variable named `connection-string` gets its value from the application-level `queue-connection-string` secret. Also, the Azure Queue Storage scale rule's authentication configuration uses the `queue-connection-string` secret as to define its connection.
258261

@@ -268,14 +271,17 @@ az containerapp create \
268271
--name myQueueApp \
269272
--environment "my-environment-name" \
270273
--image demos/myQueueApp:v1 \
271-
--secrets "queue-connection-string=$CONNECTIONSTRING" \
274+
--user-assigned "<USER_ASSIGNED_IDENTITY_ID>" \
275+
--secrets "queue-connection-string=keyvaultref:<KEY_VAULT_SECRET_URI>,identityref:<USER_ASSIGNED_IDENTITY_ID>" \
272276
--env-vars "QueueName=myqueue" "ConnectionString=secretref:queue-connection-string"
273277
```
274278

275279
Here, the environment variable named `connection-string` gets its value from the application-level `queue-connection-string` secret.
276280

277281
# [PowerShell](#tab/powershell)
278282

283+
Secrets Key Vault references aren't supported in PowerShell.
284+
279285
In this example, you create a container using Azure PowerShell with a secret that's referenced in an environment variable. To reference the secret in an environment variable in PowerShell, set its value to `secretref:`, followed by the name of the secret.
280286

281287
```azurepowershell-interactive

0 commit comments

Comments
 (0)