azurepowershellazure-site-recovery

Set-AzRecoveryServicesAsrVaultContext : Operation failed


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

Solution

  • 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.