Unable to recovery service vault from different resource group using azure bicep

Satish B 70 Reputation points
2023-09-05T15:38:10.9533333+00:00

Hi All,

Unable to recovery service vault from different resource group using azure bicep

I created recovery service vault in Norway west in ASR-RG

I have created vms in Norway east in AS-RG

I tried to access Recovery service vault from AS-RG. But it's getting failed. it's tried find rsv in AS-RG instead of ASR-RG

Can some one pls suggest how to fix this issue

Main.bicep file

Var rsvname = myrsv1

Param rsvresourcegroup string = 'ASR-RG'

resource rsv1 'Microsoft. recovery/vaults@2022-09-08' existing = {

name : '$(rsvname)'

Scope : resourcegroup(rsvresourcegroup)

Azure Site Recovery
Azure Site Recovery
An Azure native disaster recovery service. Previously known as Microsoft Azure Hyper-V Recovery Manager.
708 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Luke Murray 11,086 Reputation points MVP
    2023-09-05T21:27:25.83+00:00

    Your Recovery Services vault needs to be in the same region as your workloads unless you are setting up Azure Site Recovery (which based on the RSV name sounds like it).

    "Region: Select the geographic region for the vault. For you to create a vault to help protect any data source, the vault must be in the same region as the data source."

    Create and configure a Recovery Services vault

    If this is true:

    Check your scope in the main file, to make sure it's not restricted to RG (so it can't see others) Scope (Scope functions for Bicep) and whether this is set at Subscriptions and what errors are you getting?

    I just tested with the below and was able to reference my RSV:

    targetScope = 'subscription'
    
    resource rsv 'Microsoft.RecoveryServices/vaults@2023-04-01' existing = {
      name: 'prod-rsv-aue'
      scope: rg
    }
    
    resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' existing = {
      name: 'backuprsv-prod'
      scope: subscription()
    }
    
    output test string = rsv.properties.redundancySettings.crossRegionRestore
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.