[Backup] Add managed identity support for Azure Files backup - #34109
Bharat Purwar (bharatpurwar) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Hi Bharat Purwar (@bharatpurwar), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Unresolved moderate findings affect Azure Files registration handling and source-subscription scoping.
Review effort: Lite
Findings: None
What changed in this PR
Adds managed identity support and cross-subscription restore capabilities for Azure Files backup.
Changes:
- Adds KeyBased, system-assigned, and user-assigned identity registration, protection, and restore flows.
- Supports subscription-aware restore targeting.
- Updates CLI routing, parameters, help, formatting, and test coverage.
| File | Summary |
|---|---|
src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_custom_afs.py |
Adds focused Azure Files identity and restore unit tests. |
src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_afs_commands.py |
Adds recorded scenario coverage; Moderate (1 vote): source commands should explicitly use source_subscription. |
src/azure-cli/azure/cli/command_modules/backup/custom_base.py |
Routes Azure Files commands; Moderate (1 vote): reject Azure Files through the AzureWorkload path. Nit (1 vote): broaden the related diagnostic wording. |
src/azure-cli/azure/cli/command_modules/backup/custom_afs.py |
Implements identity registration and restore behavior; Moderate (1 vote): derive registration resource groups from the source resource or omit them. |
src/azure-cli/azure/cli/command_modules/backup/commands.py |
Registers the new container handler. |
src/azure-cli/azure/cli/command_modules/backup/_params.py |
Adds identity, subscription, and restore parameters. |
src/azure-cli/azure/cli/command_modules/backup/_help.py |
Documents the new command scenarios. |
src/azure-cli/azure/cli/command_modules/backup/_format.py |
Displays authentication details. |
src/azure-cli/azure/cli/command_modules/backup/_client_factory.py |
Enables subscription-specific resource clients. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
backup |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Live test results —
|
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
Please fix CI issues |
There was a problem hiding this comment.
X Engineering Agent review — validation failures and evidence required
Reviewed the bounded diff at head 4b085c8a3382f2f26b087f6daad4ab5be6434652, targeting dev. This is a COMMENT, not an approval. I am not marking this ready for human review.
Completed validation
The Tester's same-head snapshot reports 51 completed CI checks: 50 passed, block-merge failed, none pending. The reused live-test workflow is completed / failure. These are completed failures, not pending work or passing validation. No validation was dispatched, rerun, or polled during this review.
block-merge— relevance: uncertain; possible merge-policy gate. Evidence: the Tester reports this check failed, and the current PR hasdo-not-merge. The check's failure output was not supplied, so the label is not proof of the precise failure condition, nor is there evidence of a title-gate failure. Correction: the owning maintainer should inspect the check output and resolve the underlying hold deliberately; do not remove the label or rewrite metadata merely to bypass it. Verification: confirm the actual gate condition and its successful result in a later round after authorized resolution.- Live-test failure — relevance: uncertain. Evidence: the linked workflow failed for this same head; no failed-job, test-name, or traceback excerpt is available in the delegated result. A production defect versus a fixture, permission, or infrastructure failure cannot be distinguished from that result alone. Correction: provide the failed step/test diagnostics from this existing run, then address the evidenced cause. Verification: validate the affected Backup tests and the relevant managed-identity/restore integration at the corrected head in a later round. The PR description's reported successful runs do not resolve this failed workflow.
Regression coverage and test-strength evidence
The diff contains seven Backup production-file changes, focused tests in tests/latest/test_custom_afs.py, an added scenario in tests/latest/test_afs_commands.py, and its recording. Visible unit cases cover identity-argument errors, identity construction/comparison, and preserving AzureWorkload registration delegation. The scenario asserts registration identity fields and completed restore-job status. Their presence is useful evidence, not evidence that the failed live validation passed.
The regression-coverage skill returned applicable=false with empty file lists, despite these visible changes. I have not treated that result as a coverage pass.
Confirmed scenario limitation: in test_afs_commands.py:359–366, both source and target subscriptions use self.get_subscription_id() during playback. Consequently, that scenario alone cannot distinguish correct cross-subscription client selection from accidentally using the source subscription. Please preserve distinct sanitized source/target IDs in playback, or demonstrate focused assertions that the requested target subscription reaches both resource lookup and file-share validation while vault operations retain their source scope. Those assertions should fail if target-subscription forwarding is removed.
The bounded output truncated the unit-test tail and omitted the recording payload, so I cannot establish whether complementary assertions already cover this limitation. This is an unresolved validation gap, not a claim that a production subscription-routing defect has been demonstrated.
Repository review findings and conventions
The seven-skill summary reported zero deterministic findings; its semantic review targets are not an automatic pass. The visible diff adds help examples, forwards identity/target-subscription options through the Backup wrappers, and explicitly rejects managed-identity restore with --use-secondary-region.
Generated ownership is not applicable: no AAZ-generated surface is changed, so no generation-source PR requirement was triggered. The component-prefixed [Backup] title is present. Please ensure the release-note title or History Notes also explicitly represents the new cross-subscription Azure Files restore behavior, not just managed-identity support; a direct HISTORY.rst edit is not requested. No linked issue was supplied, so no Fixes #N reference should be invented—use it if an actual issue is identified.
Risk and human ownership
High risk (repository assessment: 59): re-registration can change authentication for all protected shares in a storage account, and restores gain destination-subscription selection. Backup/identity owning-team review is required; it was not verified by these bounded inputs. No outstanding human change-request review was returned. Preserve the existing merge hold and Agent request state while the failed-validation diagnostics and coverage evidence remain unresolved. This review neither approves nor merges the PR.
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
Please fix CI issues |
🤖 PR Validation —⚠️ Review suggested
Summary
Validation
test_custom_afstests passedtest_afs_msi_reregistration_protection_restorerecording playback passedgit diff --cached --checkpassed before commit