(Azure)How to change retention period of each policy in Recoverservices vault

Welcome Forums General PowerShell Q&A (Azure)How to change retention period of each policy in Recoverservices vault

Viewing 1 reply thread
  • Author
    Posts
    • #104896
      Participant
      Topics: 3
      Replies: 2
      Points: 0
      Rank: Member

      Need help on changing retention period of each backup policy in Recovery services vault .We have multiple vaults and many policies in each vault .Hence wanted to script the process.

      Below is the script i used to get all policies in all vaults .But not able to change the retention period of each policy

      $recoveryServicesVaults=Get-AzureRmRecoveryServicesVault
      foreach($recoveryServicesVault in $recoveryServicesVaults)
      {
      Set-AzureRmRecoveryServicesVaultContext -Vault $recoveryServicesVault
      $backupPolicies=Get-AzureRmRecoveryServicesBackupProtectionPolicy -WarningAction Ignore
      [email protected]()
      foreach($backupPolicy in $backupPolicies)
      {
      $Info = New-Object PSObject -Property @{
      PolicyName=$backupPolicy.Name
      WorkloadType=$backupPolicy.WorkloadType
      DailyRetentionPolicyDuration=$backupPolicy.RetentionPolicy.dailyschedule.DurationCountInDays

      }
      $backupPolicyArray += $Info

      }
      $backupPolicyArray
      }

    • #108932
      Senior Moderator
      Topics: 9
      Replies: 1236
      Points: 4,443
      Helping Hand
      Rank: Community Hero

      You can use set-azurermrecoveryservicesbackupprotectionpolicy cmdlet and the examples and usages are well documented here

Viewing 1 reply thread
  • The topic ‘(Azure)How to change retention period of each policy in Recoverservices vault’ is closed to new replies.