[dataprotection] Add autoprotection support for blob backup instances#9820
[dataprotection] Add autoprotection support for blob backup instances#9820Komla-Ansah wants to merge 2 commits intoAzure:mainfrom
Conversation
- Bump API version to 2026-03-01 for backup-instance create, update, validate-for-backup, and validate-for-update commands - Add --auto-protection and --exclusion-prefixes parameters to initialize-backupconfig for AzureBlob and AzureDataLakeStorage - Add get_blob_autoprotection_config helper with support for BlobBackupDatasourceParametersForAutoProtection and AdlsBlobBackupDatasourceParametersForAutoProtection object types - Add validation: auto-protection is mutually exclusive with --container-list and --include-all-containers - Add 9 unit tests covering positive and negative scenarios - Bump extension version to 1.10.0 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
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 |
|
There was a problem hiding this comment.
Pull request overview
Adds auto-protection support for Azure Blob / ADLS backup-instance initialization in the dataprotection CLI extension, alongside an API version bump for backup-instance create/update/validate commands.
Changes:
- Bumped backup-instance create/update/validate-for-backup/validate-for-update to API version
2026-03-01. - Added
--auto-protectionand--exclusion-prefixestoaz dataprotection backup-instance initialize-backupconfigforAzureBlobandAzureDataLakeStorage, including mutual-exclusion validation. - Added scenario tests covering auto-protection configurations and invalid argument combinations; bumped extension version to
1.10.0.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/dataprotection/setup.py | Bumps extension package version to 1.10.0. |
| src/dataprotection/HISTORY.rst | Adds release notes entry for 1.10.0. |
| src/dataprotection/azext_dataprotection/manual/helpers.py | Adds helper to generate blob auto-protection backupconfig payload. |
| src/dataprotection/azext_dataprotection/manual/custom.py | Wires new auto-protection args into initialize-backupconfig and adds validation. |
| src/dataprotection/azext_dataprotection/manual/_params.py | Adds CLI parameters --auto-protection and --exclusion-prefixes. |
| src/dataprotection/azext_dataprotection/manual/_help.py | Adds help examples for auto-protection usage. |
| src/dataprotection/azext_dataprotection/tests/latest/test_dataprotection_configs.py | Adds tests for auto-protection config output and invalid arg combos. |
| src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_instance/_create.py | API version bump + schema additions for auto-protection settings. |
| src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_instance/_update.py | API version bump + schema additions for auto-protection settings. |
| src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_instance/_validate_for_backup.py | API version bump + schema additions for auto-protection settings. |
| src/dataprotection/azext_dataprotection/aaz/latest/dataprotection/backup_instance/_validate_for_update.py | API version bump + schema additions for auto-protection settings. |
| if datasource_type == "AzureKubernetesService": | ||
| if any([vaulted_backup_containers, include_all_containers, storage_account_name, storage_account_resource_group]): | ||
| if any([vaulted_backup_containers, include_all_containers, storage_account_name, storage_account_resource_group, | ||
| auto_protection, auto_protection_exclusion_prefixes]): |
There was a problem hiding this comment.
The AKS datasource-type validation uses truthiness in any([... auto_protection, auto_protection_exclusion_prefixes]). With get_three_state_flag(), passing --auto-protection false results in False (falsy) and will not be rejected even though the parameter is not applicable to AKS. Consider checking explicit presence instead (e.g., is not None) for three-state flags to reliably reject unsupported parameters.
| auto_protection, auto_protection_exclusion_prefixes]): | |
| auto_protection is not None, auto_protection_exclusion_prefixes is not None]): |
| if auto_protection: | ||
| if any([vaulted_backup_containers, include_all_containers]): | ||
| raise InvalidArgumentValueError('--auto-protection cannot be used with --container-list or --include-all-containers.') | ||
| if any([storage_account_name, storage_account_resource_group]): | ||
| raise InvalidArgumentValueError('--storage-account-name and --storage-account-resource-group are not applicable with --auto-protection.') |
There was a problem hiding this comment.
The mutual-exclusion checks under if auto_protection: use truthiness for include_all_containers (a three-state flag). If a user passes --include-all-containers false alongside --auto-protection true, the any([vaulted_backup_containers, include_all_containers]) check won’t catch it. Use explicit is not None / argument presence checks for three-state flags to ensure invalid combinations are consistently rejected.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
Adds autoprotection support for blob backup instances in the \dataprotection\ CLI extension.
Changes
Testing
Related