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.
CodePudding user response:
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