Find Azure backup/retention associated with backup policy

瘦欲@ 提交于 2019-12-02 03:00:11

问题


I can get backup policy name via : How to find Azure VM applied backup protection policy name via Powershell BUT looking to find actual configuration associated with backuppolicy like following data :

BACKUP FREQUENCY

Daily at 00:00 RETENTION RANGE

Retention of daily backup point

Retain backup taken every day at 00:00 for 7 Day(s) Retention of weekly backup point

Retain backup taken every week on Saturday at 00:00 for 4 Week(s) Retention of monthly backup point

Retain backup taken every month on First Saturday at 00:00 for 12 Month(s) Retention of yearly backup point

Retain backup taken every year in January on First Saturday at 00:00 for 99 Year(s)


回答1:


You could use Get-AzureRmRecoveryServicesBackupProtectionPolicy|fl to get them.

For example:

##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"

$policyname=$item.ProtectionPolicyName
$policy=Get-AzureRmRecoveryServicesBackupProtectionPolicy -Name $policyname

##BACKUP FREQUENCY
$policy.SchedulePolicy
##RETENTION RANGE
$policy.RetentionPolicy


来源:https://stackoverflow.com/questions/47537916/find-azure-backup-retention-associated-with-backup-policy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!