Agentless, cloud-native backup for Microsoft Azure
Post Reply
ratkinsonuk
Expert
Posts: 156
Liked: 22 times
Joined: Dec 10, 2018 10:59 am
Full Name: Robert Atkinson
Contact:

Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by ratkinsonuk »

Re case #08009612.

We're trying to use Veeam in Azure to take a snapshot of the VM before we apply O/S patches so we have something to restore back to if there are any issues. The snapshot would be held for a couple of days and then deleted. These would sit alongside the requirement for other manual snapshots, such as for application upgrades.

We have a couple of problems...

- VBAZ doesn't allow an automatic retention for manual snapshots, which would be great as I wouldn't have to script my own housekeeping

- The API for deleting manual snapshots only goes down to server level, and doesn't allow specific manual snapshots to be deleted (https://helpcenter.veeam.com/references ... lSnapshots)

- Although the API allows for custom tags to be assigned to manual snapshots, there's nothing regarding a description/reason field which I think would make sense when reviewing and housekeeping old snapshots

Please can I request an enhancement to add this additional functionality.

It's possible to identify and delete the snapshots from the Azure API, but the Veeam documentation specifically says not to do this. I believe the documentation is talking about snapshots that form part of the backup chain, and not manual snapshots. It would be good to get a view from R&D on this as it may be a workaround.

Thanks, Rob.
nielsengelen
Product Manager
Posts: 6301
Liked: 1321 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by nielsengelen »

Hi Rob,

If you manually create a snaphot, you can remove those via the "Available Restore Points" popup by opening it from the "Protected Data" page and then filter for the VM. If you then select the number of Restore Points (from the column), you will see a button "Remove Manual Snapshot".

We'll look into custom retention for a future release.
GitHub: https://github.com/nielsengelen
ratkinsonuk
Expert
Posts: 156
Liked: 22 times
Joined: Dec 10, 2018 10:59 am
Full Name: Robert Atkinson
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by ratkinsonuk »

Apologies Neils, I should have clarified. I was already aware and re-confirmed by the support staff that this is something that's available from the GUI. However, it needs to be automatable as we'll have over 600 patching snapshots every month to deal with - not something we can do manually.

That actually leads me to another question.

According to recent comments, R&D are going to structure the Veeam internals so that everything goes through the REST API layer. That means the VBAZ appliance GUI may already be using the REST API to remove individual manual snapshots. Is that something that exists but hasn't been documented or are you still running directly through a .Net layer for VBAZ?
nielsengelen
Product Manager
Posts: 6301
Liked: 1321 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by nielsengelen »

Hi Robert,

Do you really need to delete them 1 by 1? Since we do have an option to delete all manual snapshots at once, wouldn't this be a better solution then?
GitHub: https://github.com/nielsengelen
ratkinsonuk
Expert
Posts: 156
Liked: 22 times
Joined: Dec 10, 2018 10:59 am
Full Name: Robert Atkinson
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by ratkinsonuk »

Most definitely Niels.

Snapshots will be taken for 3 specific reasons - as part of the backup chain, prior to patching and as part of an application/system upgrade. Patching snapshots can be deleted automagically after 3 days, but application snapshots could potentially be kept for longer periods. We need to be able to seperate out the two.

Cheers, Rob.
nielsengelen
Product Manager
Posts: 6301
Liked: 1321 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by nielsengelen » 1 person likes this post

Hi Robert,

Understood the use case. I will see what could be done as a workaround and future enhancement. Please allow me a few days to dig into a potential workaround for now.
GitHub: https://github.com/nielsengelen
JonoInMelbourne
Lurker
Posts: 2
Liked: never
Joined: Mar 16, 2026 5:20 am
Full Name: Jono Clifton
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by JonoInMelbourne »

nielsengelen wrote: Mar 05, 2026 4:06 pm Hi Robert,

Do you really need to delete them 1 by 1? Since we do have an option to delete all manual snapshots at once, wouldn't this be a better solution then?
Can you clarify "Since we do have an option to delete all manual snapshots at once". I have created manual snapshots of multiple azure vms. Is there a way i can easily delete all the manual snapshots at once?

In addition i assigned a custom tag to my manual snapshots. How can i list manual snapshots with this tag? i dont see anywhere in the VBAZ GUI where i could see any reference to these cistom tags.
ratkinsonuk
Expert
Posts: 156
Liked: 22 times
Joined: Dec 10, 2018 10:59 am
Full Name: Robert Atkinson
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by ratkinsonuk »

Hi Jono. Here's some code I'm currently developing to handle the manual snapshot side. The key element is ' .BackupDestination -eq "ManualSnapshot" '.

I also use tags to try and identify different types of snapshots. My backups have a 'VeeamBackup' tag and my snapshots have a 'VeeamManualSnapshot' tag (applied in my snapshot scripts).

Code: Select all

VERBOSE: Found snapshot for 03/11/2026 15:37:47
VERBOSE: Found Veeam tag 'Veeam backup appliance ID'
VERBOSE: Found Veeam tag 'VeeamManualSnapshot'
VERBOSE: Found Veeam manual snapshot tag 'VeeamManualSnapshot'
VERBOSE: Found Veeam tag 'veeam01'
VERBOSE: Found Veeam tag 'veeam02'
VERBOSE: Found Veeam tag 'veeam03'

Code: Select all

#region Change Control
<# 
------------------------------------------------------------------------------
AUTHOR: Robert Atkinson - October 2025 
------------------------------------------------------------------------------
DESCRIPTION: Utility to return backup points for Veeam Azure backups.
             By default the latest backup points for all servers are returned,
             but can be filtered using the parameters below.
------------------------------------------------------------------------------
RUN FREQUENCY      : As required
PRERUN REQUISITES  : None
PARAMETERS         : Server - can be used to return a single server
                     AllPoints - can be used to return all backups points
USAGE              : Get-VeeamAzureRestorePoints -Server "MYSERVER" -AllPoints
ENHANCEMENTS       : 
------------------------------------------------------------------------------
AMENDMENT LOG:
Date        By          Reason
------------------------------------------------------------------------------

#>
#endregion

function Get-VeeamAzureRestorePoints {

    #region CLI Parameters
    [CmdletBinding()]
    param
    (
        [Parameter()]
        [string] $Server = $null,
        [Parameter()]
        [switch] $AllPoints = $False,
        [Parameter()]
        [switch] $ManualSnapshots = $False,
        [Parameter()]
        [switch] $Immutable = $False,
        [Parameter()]
        [string] $SessionID


    )
    #endregion


    #region Main

    Try {
        $Error.Clear()

        # Connect to the Veeam API
        if (-not (Test-VeeamAPISession)) {
            Write-Host "Connecting to Veeam Azure API"
            $AuthResult = Connect-VeeamAzureAPI
    
            if (-not $AuthResult) {
                Write-Host -ForegroundColor Red "Failed to authenticate with the API"
                exit
            }
        }

        $QueryParams += "?Limit=999999999"
        $SortedList = @()

        if (![string]::IsNullOrEmpty($Server)) {
            # Search by server name
            $ServerID = Get-VeeamAzureServerID -Server $Server

            if ([string]::IsNullOrEmpty($ServerID)) {
                # No point in running the API query
                Write-Verbose "Unable to locate the server so ignoring collection of restore points"
                return $null
            }

            $QueryParams += "&VirtualMachineId=$ServerID"
        }

        $URL = "$Global:VeeamDefaultAPIURL/restorePoints/virtualMachines" + $QueryParams
        Write-Verbose "URL: '$URL'"

        $Response = Invoke-RestMethod -Uri $URL -Method GET -Headers $Global:VeeamApiHeaders
        Write-Verbose "Total returned records: $($Response.results.count)"

        $SortedList = $Response.results | Sort-Object -Property @{Expression={$_.vmName}}, @{Expression={$_.PointInTimeLocalTime} ;Descending=$true}

        if (![string]::IsNullOrEmpty($SessionID)) {
            $SortedList = $SortedList | Where-Object {$_.jobSessionId -eq $SessionID}
            Write-Verbose "Restore points with session ID of '$SessionID': $($SortedList.count)"
        }

        

        if ($ManualSnapshots) {
            $SortedList = $SortedList | Where-Object { $_.BackupDestination -eq "ManualSnapshot" }
            Write-Verbose "Manual restore points: $($SortedList.count)"
        }
                
        if ($Immutable) {
            $SortedList = $SortedList | Where-Object { ![string]::IsNullOrEmpty($_.ImmutableTill) }
            Write-Verbose "Immutable restore points: $($SortedList.count)"
        }
                
        if ($AllPoints) {
            Write-Verbose "Returning all restore points"
        } else {
            Write-Verbose "Returning the last entry for the server(s)"

            $LastServer = ""
            $UniqueList = @()

            foreach ($Entry in $SortedList) {
                if ($Entry.vmName -eq $LastServer) { continue }

                Write-Verbose "Adding $($Entry.vmName) - $($Entry.PointInTimeLocalTime) to the list"
                $LastServer = $Entry.vmName
                $UniqueList += $Entry
            }

            $SortedList = $UniqueList
        }

        return $SortedList


    }
    catch {
        throw
    }

    #endregion


}

For the snapshot removal...

Code: Select all

    $SnapshotIDs = @("zkrs1bd48a4wgg8z9edhtb8zgrh5gx859rg5c773tpuyornkrk9o")

    $SnapshotSettings = @{
        ids = $SnapshotIDs
    }

    $SnapshotSettingsJSON = ConvertTo-Json -Depth 10 -InputObject $SnapshotSettings

    $URL = "$Global:VeeamDefaultAPIURL/protectedItem/virtualMachines/deleteManualSnapshots"
    Write-Verbose "URL: '$URL'"

    $JobSession = Invoke-RestMethod -Uri $URL -Method POST -Headers $Global:VeeamApiHeaders -Body $SnapshotSettingsJSON

    return $JobSession
JonoInMelbourne
Lurker
Posts: 2
Liked: never
Joined: Mar 16, 2026 5:20 am
Full Name: Jono Clifton
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by JonoInMelbourne »

We are on the same page certainly. I got lost trying to use the powershell. For dummies like me if only we could have in the VBAZ GUI, In 'Protected Data' and extra tab at the top for 'Snaphots', and then be able to filter by 'custom tag' contains text.

am i right in thinking your powershell deals with a single subscription? i am creating manual snapshots from my 1 instance of VBAZ into multiple subscriptions
ratkinsonuk
Expert
Posts: 156
Liked: 22 times
Joined: Dec 10, 2018 10:59 am
Full Name: Robert Atkinson
Contact:

Re: Enhancement Request: Delete Specific VBAZ Manual Snapshots

Post by ratkinsonuk »

No, we have lots of subscriptions managed by multiple worker accounts. I have a utiltity that works out which accounts to use when looking at the snapshots.

Unfortunately, you need a fairly good understanding of how VBAZ works to be able to put the scripts together, but even then, there are quite a few bugs and missing functions in the API, e.g. you can't trigger a re-scan of an orphaned VBAZ appliance in B&R - you have to use the GUI.

Let me know if you need any help with your API code, if you decide to go down that route.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests