Skip to content

[Cosmos DB] Add support for user identity to 'az cosmosdb identity assign/remove'#19533

Merged
evelyn-ys merged 19 commits into
Azure:devfrom
zehende:useridentity
Sep 29, 2021
Merged

[Cosmos DB] Add support for user identity to 'az cosmosdb identity assign/remove'#19533
evelyn-ys merged 19 commits into
Azure:devfrom
zehende:useridentity

Conversation

@zehende
Copy link
Copy Markdown
Contributor

@zehende zehende commented Sep 10, 2021

Description
This PR adds support for user identity in additional to system manages service identity, along with the relevant tests.

The parameter '--identities' has been added to the commands 'az cosmosdb identity assign' and 'remove' to accept a space-separated list of identities, which, in addition to the existing '[system]' for system-managed identity, supports user-managed identities.

Examples:

  • Assign an existing user identity to a cosmos db account
    az cosmosdb identity assign -g myrg -n mycdbact --identities /subscriptions/00000000-0000-0000-00000000/resourcegroups/MyRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MyID

  • Remove a user identity from a cosmos db account
    az cosmosdb identity remove -g myrg -n mycdbact --identities /subscriptions/00000000-0000-0000-00000000/resourcegroups/MyRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MyID

  • Add system managed identity and user identity to a cosmos db account
    az cosmosdb identity assign -g myrg -n mycdbact --identities [system] /subscriptions/00000000-0000-0000-00000000/resourcegroups/MyRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MyID

  • Update the default identity to user identity
    az cosmosdb update -g myrg -n mycdbact ... --default-identity UserAssignedIdentity=/subscriptions/00000000-0000-0000-00000000/resourcegroups/MyRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MyID

Testing Guide
azdev test cosmosdb

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Sep 11, 2021

Cosmos DB

@xujin-zhang
Copy link
Copy Markdown
Contributor

Hi, can you extend the description like this:
#17583

So it makes the commands sets more clear. Thanks a lot!

Comment thread .gitignore Outdated
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread testcert.cer Outdated
Copy link
Copy Markdown

@j-patrick j-patrick left a comment

Choose a reason for hiding this comment

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

I added one comment, would like to see the test I can't find, then I will sign off. :)

Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread testcert.cer Outdated
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py Outdated
Comment thread .gitignore Outdated
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants