Skip to content

Commit 58c6437

Browse files
authored
Merge pull request #126973 from v-jaswel/aca/v-jaswel_20250527_public_pr_126903
[ACA] Address public PR 126903 re remove all user-assigned identity assignments
2 parents 1bbd88c + ef00747 commit 58c6437

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

articles/container-apps/managed-identity.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.custom:
88
- devx-track-azurecli
99
- build-2025
1010
ms.topic: how-to
11-
ms.date: 10/25/2023
11+
ms.date: 06/03/2025
1212
ms.author: cshoe
1313
---
1414

@@ -489,9 +489,28 @@ To remove all user-assigned identities:
489489

490490
```azurecli
491491
az containerapp identity remove --name <APP_NAME> --resource-group <GROUP_NAME> \
492-
--user-assigned <IDENTITY1_RESOURCE_ID> <IDENTITY2_RESOURCE_ID>
492+
--user-assigned $(az containerapp show \
493+
--name <APP_NAME> \
494+
--resource-group <GROUP_NAME> \
495+
--query "identity.userAssignedIdentities | keys(@)" \
496+
--output tsv)
493497
```
494498

499+
Replace the `<PLACEHOLDERS>` with your values.
500+
501+
The command to remove all user-assigned identities works as follows.
502+
503+
| Command or argument | Description |
504+
|---|---|
505+
| `--user-assigned $(...)` | Run the command enclosed by the parentheses. Send the output to `--user-assigned`. |
506+
| `az containerapp show...` | Get information about the specified container app. |
507+
| `--query "identity.userAssignedIdentities...` | Get the user-assigned identities for the specified container app. |
508+
| `\|` | The pipe operator sends the user-assigned identities to the `keys` command. |
509+
| `keys(@)` | The user-assigned identities are returned as a set of key/value pairs. Each key is the ID of a user-assigned identity. This command extracts each key. |
510+
| `--output tsv` | Output the results in tab-separated format. |
511+
512+
For more information see [How to query Azure CLI command output using a JMESPath query](/cli/azure/use-azure-cli-successfully-query).
513+
495514
# [ARM template](#tab/arm)
496515

497516
To remove all identities, set the `type` of the container app's identity to `None` in the ARM template:

0 commit comments

Comments
 (0)