[RecoveryServices.Backup] Fix CSB protection for Azure VMs with user-assigned identities - #30156
Conversation
Avoid deserializing unused VM identity data during cross-subscription validation and add regression coverage for combined managed identities. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e030d40d-2547-4a63-aff8-8ef92658f7cf
Rely on Backup service validation for missing VMs, missing resource groups, and region compatibility, avoiding generic VM response deserialization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e030d40d-2547-4a63-aff8-8ef92658f7cf
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution Prabhkiratnitp! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
🟡 Changes recommended
CSB playback recordings must be updated for the removed VM GET request.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Removes faulty VM validation that blocked CSB protection for VMs with user-assigned identities.
Changes:
- Removed VM lookup and location validation.
- Removed obsolete resource messages and accessors.
- Added a changelog entry.
File summaries
| File | Summary |
|---|---|
src/RecoveryServices/RecoveryServices/ChangeLog.md |
Documents the fix. |
src/RecoveryServices/RecoveryServices.Backup.ServiceClientAdapter/RMAPIs/ResourceAPIs.cs |
Removes the unused VM lookup helper. |
src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs |
Removes faulty CSB validation. |
src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.resx |
Removes obsolete messages. |
src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs |
Removes generated accessors. |
Review details
Files not reviewed (1)
- src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs: Generated file
Suppressed comments (1)
src/RecoveryServices/RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs:152
- The regression being fixed is specific to CSB VMs with a user-assigned identity, but every existing CSB recording covers a VM whose response has only
identity.type: SystemAssigned; the check-in wrappers atRecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.cs:367-389therefore do not exercise the reported case. Add a recorded/check-in scenario with a user-assigned identity so this removal is protected by an automated regression test.
string containerType = "iaasvmcontainerv2";
- Files reviewed: 4/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e030d40d-2547-4a63-aff8-8ef92658f7cf
There was a problem hiding this comment.
🟡 Changes recommended
Regression coverage does not exercise user/combined identities, and existing modify-policy assertions were removed; the scenario header is also stale.
Get a fresh assessment by requesting another Copilot review.
Review details
Files not reviewed (1)
- src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs: Generated file
Suppressed comments (1)
src/RecoveryServices/RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.ps1:1570
- This change removes the entire
-Item/new-policy portion of the CSB scenario, but the removedGetVmResourcevalidation only ran whenitemBase == null(the initial-protection path); the modify path was not affected by this fix. The check-in suite therefore loses its only CSB policy-modification assertions. Please retain that scenario and its recording, or add an equivalent regression test.
# Enable CSB protection for a VM in a different subscription.
- Files reviewed: 6/9 changed files
- Comments generated: 2
- Review effort level: Lite
|
|
|
/azp run |
|
Commenter does not have sufficient privileges for PR 30156 in repo Azure/azure-powershell |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e030d40d-2547-4a63-aff8-8ef92658f7cf
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Add focused regression coverage for UAI-backed VMs and reconcile the changelog validation description.
Review effort: Lite
Findings: None
Resolved since last review (3)
Files not reviewed (1)
- src/RecoveryServices/RecoveryServices.Backup.Models/Properties/Resources.Designer.cs: Generated file



🤖 PR Validation — ️✔️ All clear
Description
Removing faulty GetVmResource() validation check, as it was blocking customer to protect CSB VM (having UserAssigned identity associated with them).
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.