Forum Discussion

dolphin168's avatar
dolphin168
Copper Contributor
Oct 02, 2021

List of backup more than 90 days

Hi,

 

We have setup VM monthly backup with 12 months retention in Azure, how to list out the old backup records?  

1 Reply

  • Ankit Kotnala's avatar
    Ankit Kotnala
    Brass Contributor

    dolphin168 

    You can use below powershell commandlet

    Get-AzRecoveryServicesBackupRecoveryPoint 

     Here is a sample script you can run, change the start and end date as per your need: 

     

    $vmName = ""
    $vaultName = ""
    
    $vaultId = (Get-AzREcoveryServicesVault -Name $vaultName).ID
    
    $Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVM -Status Registered -VaultId $vaultId -FriendlyName $vmName
    
    $item = Get-AzRecoveryServicesBackupItem -Container $Container -WorkloadType AzureVM -VaultId $vaultId
    $startDate = (Get-Date).AddDays(-27)
    $endDate = (Get-Date).AddDays(3)
    
    Get-AzRecoveryServicesBackupRecoveryPoint -Item $item -VaultId $vaultId -StartDate $startDate.ToUniversalTime() -EndDate $endDate.ToUniversalTime()