Reputation: 381
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
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:
Upvotes: 1