Skip to content

[Dataprotection] az dataprotection backup-instance update-msi-permissions: Fix --operation Restore for --datasource-type AzureCosmosDB#9890

Merged
calvinhzy merged 2 commits into
Azure:mainfrom
Shashank1306s:fix/cosmos-restore-msi-permissions
May 21, 2026
Merged

[Dataprotection] az dataprotection backup-instance update-msi-permissions: Fix --operation Restore for --datasource-type AzureCosmosDB#9890
calvinhzy merged 2 commits into
Azure:mainfrom
Shashank1306s:fix/cosmos-restore-msi-permissions

Conversation

@Shashank1306s
Copy link
Copy Markdown
Contributor

Problem

az dataprotection backup-instance update-msi-permissions --datasource-type AzureCosmosDB --operation Restore raised:

Set permissions for restore is currently not supported for given DataSourceType

This is a bug introduced in #9745 (Cosmos DB onboarding, released as 1.11.0) — AzureCosmosDB was not added to the allow-list for the Restore operation.

Fix

Add AzureCosmosDB to the allow-list in custom.py (line 552-553) so the command correctly assigns Cosmos DB Operator on the target Cosmos DB account to the backup vault's managed identity.

Testing

Tested end-to-end live against subscription 97cda027-4279-4cde-b4ff-19afa0021d87 (cosmos-bugbash-CLIrg-5):

Step Result
update-msi-permissions --operation Backup ✅ Reader + Cosmos DB Operator on RG
update-msi-permissions --operation Restore ✅ Cosmos DB Operator on target account
validate-for-restore
restore trigger → job ✅ Completed

Changelog

Version bumped to 1.11.1.

az dataprotection backup-instance update-msi-permissions with
--datasource-type AzureCosmosDB --operation Restore was raising
'Set permissions for restore is currently not supported for given
DataSourceType' because AzureCosmosDB was missing from the allow-list.

Add AzureCosmosDB to the allow-list so the command correctly assigns
Cosmos DB Operator on the target account to the backup vault MSI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 20, 2026 15:38
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 20, 2026

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes az dataprotection backup-instance update-msi-permissions --datasource-type AzureCosmosDB --operation Restore by allowing AzureCosmosDB for the Restore operation and bumping the extension version.

Changes:

  • Added AzureCosmosDB to the Restore allow-list used by update-msi-permissions.
  • Bumped extension version to 1.11.1.
  • Documented the fix in HISTORY.rst.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/dataprotection/setup.py Bumps package version to 1.11.1.
src/dataprotection/azext_dataprotection/manual/custom.py Permits AzureCosmosDB for --operation Restore in MSI permission updates.
src/dataprotection/HISTORY.rst Adds release notes for 1.11.1 describing the fix.

Comment thread src/dataprotection/azext_dataprotection/manual/custom.py
Comment thread src/dataprotection/azext_dataprotection/manual/custom.py
Comment thread src/dataprotection/HISTORY.rst
@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 20, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown
Contributor

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link
Copy Markdown
Contributor

@yonzhan yonzhan assigned calvinhzy and unassigned evelyn-ys May 20, 2026
@calvinhzy calvinhzy changed the title fix(dataprotection): enable update-msi-permissions --operation Restore for AzureCosmosDB [Dataprotection] az dataprotection backup-instance update-msi-permissions: Fix --operation Restore for --datasource-type AzureCosmosDB May 21, 2026
@calvinhzy
Copy link
Copy Markdown
Member

Please add test for this fix.

…ore MSI permissions

Adds test_dataprotection_update_msi_permissions_cosmosdb_restore that
verifies update-msi-permissions --operation Restore for AzureCosmosDB
correctly assigns Cosmos DB Operator on the target Cosmos DB account.

This is the regression test for the fix in custom.py that added
AzureCosmosDB to the Restore operation allow-list.

Verified live: 1 passed in 154.41s.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Shashank1306s
Copy link
Copy Markdown
Contributor Author

Hi @calvinhzy, added live test that covers this permission assignment change.

@calvinhzy calvinhzy merged commit df3d695 into Azure:main May 21, 2026
24 checks passed
@azclibot
Copy link
Copy Markdown
Collaborator

[Release] Update index.json for extension [ dataprotection-1.11.1 ] : https://dev.azure.com/msazure/One/_build/results?buildId=165027074&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants