Skip to content

[RecoveryServices.Backup] Fix CSB protection for Azure VMs with user-assigned identities - #30156

Open
Prabhkirat Singh (Prabhkiratnitp) wants to merge 4 commits into
Azure:mainfrom
Prabhkiratnitp:fix-recoveryservices-csb-combined-identity
Open

Prabhkirat Singh (Prabhkiratnitp) wants to merge 4 commits into
Azure:mainfrom
Prabhkiratnitp:fix-recoveryservices-csb-combined-identity

Conversation

@Prabhkiratnitp

@Prabhkiratnitp Prabhkirat Singh (Prabhkiratnitp) commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Tests
️✔️ 22/22

Description

Removing faulty GetVmResource() validation check, as it was blocking customer to protect CSB VM (having UserAssigned identity associated with them).

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Prabhkirat Singh added 2 commits September 15, 2026 13:46
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
Copilot AI lite review requested due to automatic review settings September 17, 2026 09:24
@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Prabhkiratnitp! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 at RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.cs:367-389 therefore 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 removed GetVmResource validation only ran when itemBase == 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

@Prabhkiratnitp
Prabhkirat Singh (Prabhkiratnitp) marked this pull request as ready for review September 22, 2026 07:56
@github-actions

Copy link
Copy Markdown

‼️ DO NOT MERGE THIS PR ‼️
This PR was labeled "Do Not Merge" because it contains code change that cannot be merged. Please contact the reviewer for more information.

@iwrinshow

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Prabhkiratnitp Prabhkirat Singh (Prabhkiratnitp) changed the title Fix recoveryservices csb combined identity [RecoveryServices.Backup] Fix CSB protection for Azure VMs with user-assigned identities Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants