How to find Azure VM applied backup protection pol

2019-08-23 23:29发布

问题:

How to find which azure backup protection policy applied on specific Azure virtual machine via Powershell

Get- AzureRmRecoveryServicesBackupProtectionPolicy asking for policyname but there are many policy under one service vault.

thanks!

回答1:

You could use following script.

##Replace Recovery service vault name
Get-AzureRmRecoveryServicesVault -Name "shui" | Set-AzureRmRecoveryServicesVaultContext

##FriendlyName is your Azure VM name
$namedContainer=Get-AzureRmRecoveryServicesBackupContainer -ContainerType "AzureVM" -Status "Registered" -FriendlyName "shui"

$item = Get-AzureRmRecoveryServicesBackupItem -Container $namedContainer -WorkloadType "AzureVM"
$item.ProtectionPolicyName