[Backup] az backup: Add Cross Subscription Backup (CSB) support for A…#33703
[Backup] az backup: Add Cross Subscription Backup (CSB) support for A…#33703Prabhkiratnitp wants to merge 1 commit into
Conversation
…zure VM - az backup protection enable-for-vm: accept a full VM ARM id in a different subscription than the vault (CSB); skip discovery and construct the container/protected-item URIs and sourceResourceId directly, after validating the VM exists and is in the vault's region - az backup restore restore-disks: support OLR for CSB protected items by deriving the container subscription from the item sourceResourceId; fail with a clear error when a friendly container name matches multiple containers - az backup item list/show: add containerSubscriptionId to the Azure VM backup item response - az backup job show: add containerSubscriptionId to the Azure VM backup job response - Add tests, recording, help examples and history notes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
There was a problem hiding this comment.
Pull request overview
This PR extends the az backup command module to support Cross Subscription Backup (CSB) scenarios for Azure VM protection and restore, and surfaces the protected VM’s subscription on item/job responses to help customers operate across vault/VM subscription boundaries.
Changes:
- Enable
az backup protection enable-for-vmto accept a full cross-subscription VM ARM ID and bypass protectable-item discovery by constructing container/item URIs directly. - Improve restore flows for CSB, including Original Location Recovery behavior and clearer failures when friendly names are ambiguous.
- Add
containerSubscriptionIdto Azure VM backup item and job outputs, plus tests/recordings/help/history notes.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/HISTORY.rst | Adds history notes documenting new CSB behavior and response fields. |
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_backup_commands.py | Adds validation for containerSubscriptionId on Azure VM backup items and introduces a playback-only ambiguity regression test. |
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/recordings/test_backup_restore_multiple_containers_same_friendly_name.yaml | Recording supporting the new ambiguity regression scenario. |
| src/azure-cli/azure/cli/command_modules/backup/custom.py | Implements CSB enable-for-vm path, ambiguity validation, OLR subscription derivation, and job response augmentation. |
| src/azure-cli/azure/cli/command_modules/backup/custom_help.py | Adds helpers to surface containerSubscriptionId for items/jobs. |
| src/azure-cli/azure/cli/command_modules/backup/custom_common.py | Ensures item list/show consistently set containerSubscriptionId. |
| src/azure-cli/azure/cli/command_modules/backup/_help.py | Adds help examples/long-summary guidance for CSB/native names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| container_uri = "IaasVMContainer;iaasvmcontainerv2;{};{}".format(vm_rg, vm_name) | ||
| item_uri = "vm;iaasvmcontainerv2;{};{}".format(vm_rg, vm_name) | ||
| vm_item_properties = _get_vm_item_properties_from_vm_id(vm) |
| return cust_help.set_job_container_subscription_id(cust_help.replace_min_value_in_subtask(response)) | ||
| response = client.get(vault_name, resource_group_name, name) | ||
| return cust_help.replace_min_value_in_subtask(response) | ||
| return cust_help.set_job_container_subscription_id(cust_help.replace_min_value_in_subtask(response)) |
|
Backup |
|
@Prabhkiratnitp please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
…zure VM
Related command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.