Collect and consolidating VM name from Azure Site Recovery Plans

%3CLINGO-SUB%20id%3D%22lingo-sub-1120168%22%20slang%3D%22en-US%22%3ECollect%20and%20consolidating%20VM%20name%20from%20Azure%20Site%20Recovery%20Plans%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1120168%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20develop%20a%20PowerShell%20script%20to%20collect%20VM%20names%20from%20each%20recovery%20plan%20and%20consolidate%2C%20which%20are%20all%20added%20into%20Azure%20Site%20Recovery%20Plan.%20I%20tried%20available%20commands(Get-AzRecoveryServicesAsrFabric%2C%20Get-AzRecoveryServicesAsrProtectableItem%2C%20Get-AzRecoveryServicesAsrProtectionContainer%2C%20Get-AzRecoveryServicesAsrRecoveryPlan%2C%20Get-AzRecoveryServicesAsrReplicationProtectedItem%2C%20Get-AzRecoveryServicesAsrServicesProvider)%20in%20Azure%20Az%20module%20which%20are%20all%20related%20one%20each%20another%20to%20get%20details.%20But%20I%20am%20not%20able%20to%20get%20correct%20details%2C%20and%20as%20it%20seems%20not%20straight%20forward%20method%20like%20Get-AzVM%20like.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20you%20please%20any%20one%20share%20the%20step%20by%20step%20procedure%20or%20suggestion%20to%20get%20the%20Protected%20VM%E2%80%99s%20in%20each%20Recovery%20plan%20and%20consolidate%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20sample%20screenshot.%20ASR-Plan1%20%26amp%3B%26nbsp%3BASR-Plan1%20are%20recovery%20plan%20names%20and%20inside%20you%20can%20able%20to%20see%20VM%20names%20which%20are%20all%20protected(enabled).%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F166287i45133C240E8536B4%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAppreciating%20in%20advance%20who%20are%20all%20helping%20on%20this.%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3CP%3EJax%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1120168%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Site%20Recovery%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

 

I would like to develop a PowerShell script to collect VM names from each recovery plan and consolidate, which are all added into Azure Site Recovery Plan. I tried available commands(Get-AzRecoveryServicesAsrFabric, Get-AzRecoveryServicesAsrProtectableItem, Get-AzRecoveryServicesAsrProtectionContainer, Get-AzRecoveryServicesAsrRecoveryPlan, Get-AzRecoveryServicesAsrReplicationProtectedItem, Get-AzRecoveryServicesAsrServicesProvider) in Azure Az module which are all related one each another to get details. But I am not able to get correct details, and as it seems not straight forward method like Get-AzVM like.

 

Could you please any one share the step by step procedure or suggestion to get the Protected VM’s in each Recovery plan and consolidate?

 

I have attached sample screenshot. ASR-Plan1 & ASR-Plan1 are recovery plan names and inside you can able to see VM names which are all protected(enabled).

clipboard_image_0.png

 

Appreciating in advance who are all helping on this.

Thanks.

Jax

0 Replies