[CosmosDB] Onboarding of backup and recovery experience#9745
Conversation
- Add AzureCosmosDB manifest (Microsoft.DocumentDB/databaseAccounts) - Register AzureCosmosDB in supported_datasource_types config - Add CosmosDB to datasource_map in helpers - Add unit tests for policy template, backup-instance initialize, restore initialize - Add e2e test with recording for backup and restore scenario
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| dataprotection backup-instance initialize | cmd dataprotection backup-instance initialize update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-instance initialize-backupconfig | cmd dataprotection backup-instance initialize-backupconfig update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-instance initialize-restoreconfig | cmd dataprotection backup-instance initialize-restoreconfig update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-instance list-from-resourcegraph | cmd dataprotection backup-instance list-from-resourcegraph update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-instance restore initialize-for-data-recovery | cmd dataprotection backup-instance restore initialize-for-data-recovery update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-instance restore initialize-for-data-recovery-as-files | cmd dataprotection backup-instance restore initialize-for-data-recovery-as-files update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-instance restore initialize-for-item-recovery | cmd dataprotection backup-instance restore initialize-for-item-recovery update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-instance update-msi-permissions | cmd dataprotection backup-instance update-msi-permissions update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection backup-policy get-default-policy-template | cmd dataprotection backup-policy get-default-policy-template update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
||
| dataprotection job list-from-resourcegraph | cmd dataprotection job list-from-resourcegraph update parameter datasource_type: updated property choices from ['AzureBlob', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] to ['AzureBlob', 'AzureCosmosDB', 'AzureDataLakeStorage', 'AzureDatabaseForMySQL', 'AzureDatabaseForPostgreSQL', 'AzureDatabaseForPostgreSQLFlexibleServer', 'AzureDisk', 'AzureKubernetesService'] |
|
Hi @Shashank1306s, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
Release SuggestionsModule: dataprotection
Notes
|
zubairabid
left a comment
There was a problem hiding this comment.
Please add the test file itself, and confirm that the update-msi-permissions command is not broken for the new workload.
There was a problem hiding this comment.
I can see the test recording, but not the test file itself - did we not commit that?
There was a problem hiding this comment.
Added. please review
| "addDataStoreParametersList": false, | ||
| "friendlyNameRequired": false, | ||
| "supportSecretStoreAuthentication": false, | ||
| "backupVaultPermissions": [ |
There was a problem hiding this comment.
Query: have we tested if the update-msi-permissions command works as expected with this set of permissions?
There was a problem hiding this comment.
[update-msi-permissions] worked end-to-end and the permissions it set were exactly sufficient to complete configure-protection, adhoc-backup, and AlternateLocation restore
…ns test - Add unit test file test_dataprotection_cosmosdb.py (was missing from earlier commit) - Add live e2e Cosmos scenario test in test_dataprotection_backup_and_restore_workloads.py - Add live test_dataprotection_update_msi_permissions_cosmosdb covering manifest backupVaultPermissions (Reader on DataSourceRG, Cosmos DB Operator on DataSource) using persistent cosmos-bugbash-CLIrg-6 accounts - Update helpers.get_help_word_from_permission_type for AzureCosmosDB datasource label - Bump dataprotection extension to 1.9.0 and update HISTORY.rst
There was a problem hiding this comment.
Pull request overview
This PR onboards Azure Cosmos DB (account-level Microsoft.DocumentDB/databaseAccounts) as a supported workload in the dataprotection Azure CLI extension, including manifest registration, helper mappings, and scenario/unit test coverage for the backup/restore experience.
Changes:
- Bumped the
dataprotectionextension version to1.11.0and added release notes. - Added an
AzureCosmosDBmanifest and wired it into supported datasource types + datasource mapping + permission help text. - Added Cosmos DB-focused tests (unit-style CLI payload validation + live scenario + live MSI permission update) and a new recording.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/dataprotection/setup.py | Bumps extension version to 1.11.0. |
| src/dataprotection/HISTORY.rst | Adds 1.11.0 changelog entry for Cosmos DB onboarding and tests. |
| src/dataprotection/azext_dataprotection/manual/Manifests/config.py | Registers AzureCosmosDB as a supported datasource type. |
| src/dataprotection/azext_dataprotection/manual/Manifests/AzureCosmosDB.py | Adds the Cosmos DB workload manifest (policy + permissions + restore constraints). |
| src/dataprotection/azext_dataprotection/manual/helpers.py | Adds Cosmos DB datasource mapping/help text; adds snake→camel override for resource_id→resourceID. |
| src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_update_msi_permissions.py | Adds a live-only Cosmos DB update-msi-permissions scenario. |
| src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_cosmosdb.py | Adds unit-style CLI tests for default policy template, backup-instance initialize, and restore initialize outputs. |
| src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_backup_and_restore_workloads.py | Adds a live-only end-to-end Cosmos DB backup + alternate-location restore scenario with explicit protection-status polling. |
| src/dataprotection/azext_dataprotection/tests/latest/recordings/test_dataprotection_backup_and_restore_cosmosdb.yaml | Adds a recording for the Cosmos DB scenario. |
| from azure.cli.testsdk import ScenarioTest | ||
| from azure.cli.testsdk.scenario_tests import AllowLargeResponse | ||
|
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 9745 in repo Azure/azure-cli-extensions |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ dataprotection-1.11.0 ] : https://dev.azure.com/msazure/One/_build/results?buildId=164892035&view=results |
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.