Ashok Developer
Ashok Developer

Reputation: 381

error while getting asr replication items details in azure powershell

I'm using azure PowerShell to get the replicated item details using the below code, as per the documentation the program is correct but it's giving an error as below.

$VaultName = 'Site-recovery-vault-westus'
$vault = Get-AzRecoveryServicesVault -Name $VaultName
Set-AzRecoveryServicesAsrVaultContext -Vault $vault
$fabric = Get-AzRecoveryServicesAsrFabric
$container = Get-AzRecoveryServicesAsrProtectionContainer -Fabric $fabric
Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $container

At 5th line Error: Get-AzRecoveryServicesAsrProtectionContainer: Cannot convert 'System.Object[]' to the type 'Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRFabric' required by parameter 'Fabric'. Specified method is not supported.

Upvotes: 0

Views: 986

Answers (1)

VenkateshDodda
VenkateshDodda

Reputation: 5506

We have tested in our local environment, Below observations are based on your analysis.

By using the shared cmdlets, we able to pull the AzRecoveryServicesAsrProtectionContainer in the recovery service vault.

$fabric = Get-AzRecoveryServicesAsrFabric

As per the Azure Documentation, Get-AzRecoveryServicesAsrFabric Returns all the Azure Site Recovery fabrics in the vault.

Error: Get-AzRecoveryServicesAsrProtectionContainer: Cannot convert 'System.Object[]' to the type 'Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRFabric'

if you have more than one Fabric in your recovery service vault the above error occurs. while fetching the AzRecoveryServicesAsrProtectionContainer

We would suggest you to pass the Fabric Name as parameter to $fabric Variable to fetch Get-AzRecoveryServicesAsrProtectionContainer under that particular Fabric.

Here is the reference output screenshot:

enter image description here

Upvotes: 1

Related Questions