Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions doc/managed_identity_command_guideline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Overview
This document provides a common design of the CLI command interface for supporting Managed Identity in Azure CLI. New commands should follow it while existing commands can stay the same before a deprecation plan.

## Command interface

### Enable managed identity during resource creation
Use `--mi-system-assigned` to enable system-assigned identity and `--mi-user-assigned` with space separated resource IDs to add user-assigned identities.

```
# <resource> can be acr, webapp, vm or any other resources that support managed identity
az <resource> create ... --mi-system-assigned --mi-user-assigned <AzureResourceId1> <AzureResourceId2>
```

### Operate managed identity on existing resource
Create the `identity` subgroup under the main resource command group. Support the below operations:

1. Assign identities with `identity assign` command

Use `--system-assigned` to enable system assigned identity and `--user-assigned` with space separated resource IDs to add user assigned identities.
```
az <resource> identity assign ... --system-assigned --user-assigned <AzureResourceId1> <AzureResourceId2>
```
2. Remove identities with `identity remove` command

Use `--system-assigned` to remove system assigned identity and `--user-assigned` with space separated resource IDs to remove specified user assigned identities.
```
az <resource> identity remove ... --system-assigned --user-assigned <AzureResourceId1> <AzureResourceId2>
```
For the convenience scenario to remove all user assigned identities, `--user-assigned` with no values should remove all user assigned identities with proper warnings.
```
az <resource> identity remove ... --user-assigned
```
Comment on lines +29 to +32
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use nargs='*' for --user-assigned in identity remove, the value for user_assigned parameter is [] if --user-assigned is provided but with no vlaues.
Use nargs='+' for --user-assigned in identity assign.

3. Show identities with `identity show` command

Use this command to show the managed identity type, tenant IDs and principal IDs of the system assigned identities and all user assigned identities.
```
az <resource> identity show ...
```