Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
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>
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the Azure File Share (AFS) restore command where the restore operation would fail if the source storage account had been deleted. The fix implements a fallback mechanism to retrieve the source resource ID from the protected item's properties when the storage account is unavailable.
- Adds exception handling around the storage account ID retrieval
- Implements a fallback to use the source resource ID from the protected item
- Adds a new helper function to extract source resource ID from protected items
| if not afs_restore_request.source_resource_id: | ||
| raise CLIError("Source resource ID is null or empty after retrieval from storage account.") | ||
| except Exception as e: | ||
| logger.warning("Failed to get storage account ID: %s. Falling back to source resource ID from protected item.", str(e)) |
There was a problem hiding this comment.
The logger variable is not imported or defined in this context. You need to add 'from azure.cli.core import logger' at the top of the file or use an alternative logging approach.
zubairabid
left a comment
There was a problem hiding this comment.
Approved, requesting general clarification on code behaviour.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
az backup restore restore-azurefileshare: Fix a bug where the source storage account is deleted and the required sourceResourceId property is missing from the restore request payload
Related command
az backup restore restore-azurefileshare
Description
Implementing fix to handle cases where the source storage account is deleted & required sourceResourceId property is missing for restore request payload.
Testing Guide
Tested restore where AFS source storage account was deleted before changes were made to reproduce bug.
Tested restore where AFS source storage account was deleted after changes were made to validate fix.
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.