Skip to content

[dataprotection] Add autoprotection support for blob backup instances#9820

Open
Komla-Ansah wants to merge 4 commits intoAzure:mainfrom
Komla-Ansah:feature/autoprotection-blob-backup
Open

[dataprotection] Add autoprotection support for blob backup instances#9820
Komla-Ansah wants to merge 4 commits intoAzure:mainfrom
Komla-Ansah:feature/autoprotection-blob-backup

Conversation

@Komla-Ansah
Copy link
Copy Markdown

Description

Adds autoprotection support for blob backup instances in the \dataprotection\ CLI extension.

Changes

  • API version bump: Updated backup-instance create, update, validate-for-backup, and validate-for-update commands to API version 2026-03-01
  • New parameters: Added --auto-protection\ and --exclusion-prefixes\ to \initialize-backupconfig\ command for AzureBlob and AzureDataLakeStorage datasource types
  • Validation: Auto-protection is mutually exclusive with --container-list\ and --include-all-containers\
  • Tests: Added 9 unit tests covering positive scenarios (Blob/ADLS, with/without exclusion prefixes) and negative scenarios (invalid argument combinations)
  • Version bump: Extension version 1.9.0 1.10.0

Testing

  • All 9 new autoprotection tests pass
  • Linting (pylint, flake8) and CLI linter pass
  • Note: Some pre-existing recorded tests may fail in CI due to test subscription decommissioning (not related to this change)

Related

  • PowerShell parallel implementation: \New-AzDataProtectionBackupConfigurationClientObject\ with -AutoProtection\ switch

- 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>
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 22, 2026

⚠️Azure CLI Extensions Breaking Change Test
⚠️dataprotection
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd dataprotection backup-instance initialize-backupconfig cmd dataprotection backup-instance initialize-backupconfig added parameter auto_protection_exclusion_prefixes
⚠️ 1006 - ParaAdd dataprotection backup-instance initialize-backupconfig cmd dataprotection backup-instance initialize-backupconfig added parameter auto_protection

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 22, 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

CodeGen Tools Feedback Collection

Thank 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

@github-actions
Copy link
Copy Markdown
Contributor

@Komla-Ansah Komla-Ansah marked this pull request as ready for review April 23, 2026 00:03
Copilot AI review requested due to automatic review settings April 23, 2026 00:03
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

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-protection and --exclusion-prefixes to az dataprotection backup-instance initialize-backupconfig for AzureBlob and AzureDataLakeStorage, 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.

Comment thread src/dataprotection/azext_dataprotection/manual/custom.py Outdated
Comment thread src/dataprotection/azext_dataprotection/manual/custom.py
Comment thread src/dataprotection/HISTORY.rst Outdated
@yonzhan yonzhan assigned calvinhzy and unassigned evelyn-ys Apr 23, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@zubairabid zubairabid left a comment

Choose a reason for hiding this comment

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

The changes overall seem okay, but there's a potential bug. Please check that.

Comment thread src/dataprotection/azext_dataprotection/manual/custom.py Outdated
Comment thread src/dataprotection/azext_dataprotection/manual/custom.py
…alidation

- Use 'is not None' instead of truthiness for auto_protection and
  auto_protection_exclusion_prefixes in AKS validation
- Use 'is not None' for include_all_containers in auto-protection
  mutual exclusion check
- Fix RST underline length for 1.10.0 in HISTORY.rst

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@calvinhzy
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

The initialize-backupconfig command uses cf_blob_container_mgmt client
factory which requires Azure login. This causes test failures in CI
where no auth is available. Tests pass locally with az login.
Same pattern as existing AKS config test.

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

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 9820 in repo Azure/azure-cli-extensions

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 8, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

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