Azure / Azure/azure-powershell

Set-AzRecoveryServicesBackupProperty does not function as designed.

Open
#25,704 7 comments 0 reactions 0 assignees View on GitHub
act-observability-squad bug customer-reported Recovery Services Backup Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

The Set-AzRecoveryServicesBackupProperty cmdlet does not appear to function as designed. It does not produce errors, but instead does absolutely nothing.

In my test scenario a newly created vault exists. no backups exist in this vault yet, and the vault can be toggled between LRS and GRS in the portal, as well as enable or disable cross-region restore.

Attempting to set either the cross-region restore, or the backup storage redundancy (As documented here: https://learn.microsoft.com/en-us/powershell/module/az.recoveryservices/set-azrecoveryservicesbackupproperty?view=azps-12.0.0 ) results in **no change** to the recovery services vault.

Example to demonstrate bug
`Write-host "Getting vault"
$vault = Get-AzRecoveryServicesVault -ResourceGroupName $AttributeList.ResourceGroup -Name $AttributeList.RecoveryServicesVaultName

Write-Host "Initial Vault Properties"
get-AzRecoveryServicesBackupProperty -Vault $vault

Write-host "Setting vault redundancy"
Set-AzRecoveryServicesBackupProperty -Vault $vault -BackupStorageRedundancy LocallyRedundant -Verbose

Write-host "Vault Properties after redundancy change"
get-AzRecoveryServicesBackupProperty -Vault $vault

Write-host "Setting vault cross-region"
Set-AzRecoveryServicesBackupProperty -Vault $vault -EnableCrossRegionRestore -Verbose

Write-host "Vault Properties after cross-region change"
get-AzRecoveryServicesBackupProperty -Vault $vault
`

![image](https://github.com/user-attachments/assets/7f8a653f-2740-47f0-a70d-e938d99f52bf)
![image](https://github.com/user-attachments/assets/b00252e7-e774-4e6b-832a-0ad72cb85469)

I did find this somewhat cryptic entry in the debug logs that seems to indicate that you cannot use this API for the desired changes. However, I cannot find any mention of this error online, or any indication of why the creation of this vault (Via Azure Powershell, not Azure CLI) would trigger this incompatibility.
```
Body:
{
"error": {
"code": "BMSUserErrorRedundancySettingsUseVaultApi",
"message": "Redundancy settings for this vault cannot be modified using this API. Since the Vault API was previously used to update the redundancy set
tings for this vault, you must again use the Vault API to make any further changes to this property."
}
}
```

[DebugOutput.txt](https://github.com/user-attachments/files/16434281/DebugOutput.txt)

### Issue script & Debug output

```PowerShell
Script and debug in attached .txt file as it was too long for the github upload (Max length > 65536 chars)
```

### Environment data

```PowerShell
(Note, this output is from a PSv5 session, but the same issue can be replicated in PSv7.)

$PSVersionTable

Name Value
---- -----
PSVersion 5.1.22621.3880
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.3880
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
PS C:\Users\USERNAME> get-module az*

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 3.0.2 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script 7.0.0 Az.RecoveryServices {Add-AzRecoveryServicesAsrReplicationProtectedItemDisk, Backup-AzRecoveryServicesBackupItem,...
```

### Error output

```PowerShell
Nothing relevant (Easier than sanitizing the results of my fat-fingered connect-azaccounts)
```

Contributor guide

Open the contributing guide

Research direction

Start with the Set-AzRecoveryServicesBackupProperty and Get-AzRecoveryServicesBackupProperty entry points, then inspect DebugOutput.txt and the attached script output for the BMSUserErrorRedundancySettingsUseVaultApi response. Compare the requested redundancy and cross-region changes with the vault state; done means the cmdlet changes the properties or clearly surfaces the API incompatibility, with coverage for the reported scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.