-1

Below script works for one recovery vault but fails for another.

Script

$Sub = Get-AzSubscription -SubscriptionName ''
$context = $Sub | Set-AzContext
$rv = Get-AzRecoveryServicesVault -ResourceGroupName '' -Name ''
Set-AzRecoveryServicesAsrVaultContext -Vault $rv -defaultprofile $context

Error

Set-AzRecoveryServicesAsrVaultContext : Operation failed.
Download vault credential file using cmdlet Get-AzRecoveryServicesVaultSettingsFile and Import-AzRecoveryServicesAsrVaultSettingsFile
At line:1 char:1
+ Set-AzRecoveryServicesAsrVaultContext -Vault $rv -defaultprofile $con 
    + CategoryInfo          : CloseError: (:) [Set-AzRecoveryServicesAsrVaultContext], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.SiteRecover
Bhargavi Annadevara
  • 4,923
  • 2
  • 13
  • 30
  • Could you please add `-debug` into Set-AzRecoveryServicesAsrVaultContext and run the command `Resolve-AzError` to get error message in detail? – Jim Xu Feb 17 '21 at 02:45
  • Hi, I am working on this error . It seems to be an Permission issue. I will keep you all posted – Manvendra Bele Feb 19 '21 at 10:34

1 Answers1

0

Hi the issue was related to vnet configuration. now it is resolved.

error was was coming as data was not passing from one vnet to another.