[Backup] Add Azure File Share cross-region restore support - #33809
Open
bharatpurwar wants to merge 1 commit into
Open
[Backup] Add Azure File Share cross-region restore support#33809bharatpurwar wants to merge 1 commit into
bharatpurwar wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7a8ea165-11b7-4fc8-9919-ec589073b1fe
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
microsoft-github-policy-service
Bot
requested review from
jsntcy and
wangzelin007
July 29, 2026 04:07
Contributor
|
🔔 Routing this PR to @Azure/act-observability-squad. |
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Azure File Share cross-region restore (CRR) support to the backup command module, enabling --use-secondary-region for full-share alternate-location restores and validating target file shares before triggering the passive-stamp CRR workflow. Also adjusts CRR job/task formatting to tolerate task models missing timestamps and adds a record-only scenario test + recording.
Changes:
- Enable CRR restore flow for Azure File Share restores via passive-stamp access token + CRR trigger, tracked as a CRR job.
- Allow
--use-secondary-regionfor AzureStorage recovery point listing and wire the flag through restore entrypoints/params. - Add playback-only scenario test and recording for the AFS CRR restore path; harden CRR task timestamp formatting.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/backup/custom_afs.py | Implements the AFS CRR restore path (passive stamp) and enables secondary-region recovery point listing; adds target file share validation. |
| src/azure-cli/azure/cli/command_modules/backup/custom_base.py | Threads use_secondary_region into the restore_azurefileshare entrypoint and item resolution. |
| src/azure-cli/azure/cli/command_modules/backup/custom_common.py | Allows AzureStorage to use --use-secondary-region by updating the “not supported” list. |
| src/azure-cli/azure/cli/command_modules/backup/custom_help.py | Makes CRR task timestamp normalization resilient to missing start_time/end_time. |
| src/azure-cli/azure/cli/command_modules/backup/_params.py | Adds --use-secondary-region to backup restore restore-azurefileshare. |
| src/azure-cli/azure/cli/command_modules/backup/_client_factory.py | Introduces a Storage mgmt client factory and a file_shares_cf accessor used for target share validation. |
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_afs_commands.py | Adds a record-only scenario test covering AFS CRR restore and CRR job tracking. |
| src/azure-cli/azure/cli/command_modules/backup/tests/latest/recordings/test_afs_cross_region_restore.yaml | Adds the test recording for the new scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
18
to
+25
| from azure.cli.core.util import CLIError | ||
| from azure.cli.command_modules.backup._client_factory import protection_containers_cf, protectable_containers_cf, \ | ||
| protection_policies_cf, backup_protection_containers_cf, backup_protectable_items_cf, \ | ||
| resources_cf, backup_protected_items_cf, protected_items_cf | ||
| from azure.cli.core.azclierror import ArgumentUsageError, ValidationError | ||
| resources_cf, backup_protected_items_cf, protected_items_cf, \ | ||
| recovery_points_crr_cf, recovery_points_passive_cf, aad_properties_cf, cross_region_restore_cf, vaults_cf, \ | ||
| file_shares_cf | ||
| from azure.cli.core.azclierror import ArgumentUsageError, ValidationError, InvalidArgumentValueError | ||
| from azure.core.exceptions import ResourceNotFoundError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 PR Validation — ❌ Action needed
❌AzureCLI-FullTest
Related command
az backup item list --use-secondary-regionaz backup item show --use-secondary-regionaz backup recoverypoint list --use-secondary-regionaz backup restore restore-azurefileshare --use-secondary-regionaz backup job show --use-secondary-regionDescription
Adds Azure File Share cross-region restore support for full-share alternate-location restores. The implementation resolves protected items and recovery points from the secondary region, validates the target file share, builds the passive-stamp CRR request with the Azure Storage access token, triggers the restore, and tracks the resulting CRR job.
Also fixes Azure Storage CRR job formatting for task models without start/end timestamps.
Testing Guide
azdev test test_afs_cross_region_restore --seriesazdev style backupazdev linter backupThe scenario is playback-only and uses
test_afs_cross_region_restore.yaml; it does not contact live Azure APIs during CI or normal local test runs.History Notes
[Backup]
az backup restore restore-azurefileshare: Add Azure File Share cross-region restore support.