Skip to content

azurebackup: Fix RSV CRR live test failure - handle CloudInternalError when CRR already enabled#2599

Open
shrja-ms wants to merge 1 commit into
microsoft:mainfrom
shrja-ms:user/fix-crr-live-test
Open

azurebackup: Fix RSV CRR live test failure - handle CloudInternalError when CRR already enabled#2599
shrja-ms wants to merge 1 commit into
microsoft:mainfrom
shrja-ms:user/fix-crr-live-test

Conversation

@shrja-ms
Copy link
Copy Markdown
Contributor

@shrja-ms shrja-ms commented May 7, 2026

Problem

The DisasterRecoveryEnableCrr_RsvVault_EnablesCrossRegionRestore_Successfully live test fails on main with a CloudInternalError (500) when CRR is already enabled on the RSV vault.

CI failure: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6255795&view=logs&j=91fe1db5-1f25-54d9-1b80-aa22561a2991&t=59d2fd0c-a3cd-5700-1f52-546eceebcd75

Root Cause

The RSV ConfigureCrossRegionRestoreAsync method has two defenses against re-enabling CRR, but both fail in CI:

  1. Pre-check fails: GET /vaults/{vaultName} does not populate properties.redundancySettings.crossRegionRestore when CRR was originally configured via the legacy BackupResourceConfig API. The pre-check (CrossRegionRestore == Enabled) evaluates to false even though CRR is actually enabled.

  2. Vault PATCH returns generic error: The fallback PATCH call throws CloudInternalError (500) with no CRR-specific sub-code (target: null, details: null), making it indistinguishable from a genuine service failure. This is an Azure Backup RSV API gap (VSO bug filed requesting either idempotent success or a specific error code like CrossRegionRestoreAlreadyEnabled).

Fix

Wrap the Vault PATCH call inside the BMSUserErrorRedundancySettingsUseVaultApi catch block with a nested try/catch for CloudInternalError, treating it as "already enabled" -- consistent with the DPP implementation pattern and the command's [Idempotent = true] metadata.

Changes

  • RsvBackupOperations.cs -- Added try/catch (RequestFailedException patchEx) when (patchEx.ErrorCode == "CloudInternalError") around the Vault PATCH call, returning success with an "already enabled" message.

Testing

  • All 367 unit tests pass
  • Build succeeds

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an azurebackup live test failure when enabling Cross-Region Restore (CRR) on an RSV vault where CRR is already enabled but cannot be detected via the existing pre-check, by treating a specific backend failure (CloudInternalError) from the Vault PATCH as an idempotent success.

Changes:

  • Wraps the RSV Vault PATCH update call in a try/catch that converts RequestFailedException with ErrorCode == "CloudInternalError" into a successful “already enabled” result.

Comment thread tools/Azure.Mcp.Tools.AzureBackup/src/Services/RsvBackupOperations.cs Outdated
@shrja-ms shrja-ms force-pushed the user/fix-crr-live-test branch from 2b5fec7 to c31536f Compare May 7, 2026 08:42
…esourceConfig API

The RSV ConfigureCrossRegionRestoreAsync failed in CI when CRR was
already enabled because the Vault GET RedundancySettings.CrossRegionRestore
property is not populated when CRR was set via the legacy BackupResourceConfig
API.

Fix: Add pre-check using BackupResourceConfig.EnableCrossRegionRestore
(the same API already being called to set CRR). This property reliably
returns the CRR state regardless of how it was originally configured.
@shrja-ms shrja-ms force-pushed the user/fix-crr-live-test branch from c31536f to 048eb2c Compare May 7, 2026 08:53
@shrja-ms shrja-ms enabled auto-merge (squash) May 7, 2026 10:43
@anannya03
Copy link
Copy Markdown
Contributor

/azp run mcp - pullrequest - live

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

3 participants