Greetings friends, over the years, I’ve been creating all sorts of scripts, dashboards, or small applications to solve customer problems or community requests.
Recently, I came across a very practical challenge. When managing thousands of workloads across Microsoft Azure, administrators often need to audit or submit compliance reports on specific protection jobs. But going through the VB Azure Appliance manually? Not scalable. Especially when you’re asked for historical backup sessions across random periods.
That’s when the power of the Veeam Backup for Azure REST API shines:
- https://helpcenter.veeam.com/docs/vbazure/guide/overview.html?ver=8
- https://www.veeam.com/veeam_backup_azure_8_rest_api_reference_map_ot.pdf
Why this is great for Administrators
Managing protection across thousands of Azure workloads can easily become a time sink — especially when backup admins are asked to validate jobs based on specific policies, types, or custom date ranges. There’s no built-in UI report that offers that level of flexibility (not even in Veeam ONE as of yet)
That’s where this script helps.
With just a few lines of PowerShell, you can:
- Instantly query Veeam Backup for Azure’s REST API
- Filter sessions by job type (e.g., PolicyBackup, PolicySnapshot, etc.) and custom date range
- Generate structured, easy-to-read HTML reports
- Automatically send results via Microsoft Graph API email
- Confidently respond to compliance, audit, or license validation requests
All API-driven, automated, and 100% under your control.
Custom script in PowerShell
PowerShell remains one of the best tools when working with IT admins. It can handle API requests, process JSON, and generate HTML or CSV reports effortlessly. While combining everything into a polished HTML report can be tricky, this script does it for you.
- Download the script here: https://github.com/jorgedlcruz/veeam-html-reporting/tree/main/veeam-backup-for-azure/job-history
After running the script, you’ll get a report like this:
And email delivery works flawlessly too:
Key Components
1.- Disable SSL verification
The script disables SSL validation, common practice with VB Azure appliances using self-signed certificates. For production, secure it properly using Let’s Encrypt certificates.
# Ignore SSL certificate validation errors (Not recommended for production) Add-Type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } "@ [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
2.- Script Variables
At the top of the script, define:
- Veeam Azure server URL
- Credentials
- Reporting Date Range
- Session Types filter (comma-separated)
- Microsoft Graph Email credentials (Tenant, AppId, Secret)
# PARAMETERS $VeeamServer = "https://YOURVEEAMSERVER" $VeeamUsername = "YOURVBAZUREUSER" $VeeamPassword = 'YOURVBAZUREPASS' $ApiVersion = "v8" $RecipientEmail = "[email protected]" $TenantId = "YOUR365ORG.onmicrosoft.com" $ClientId = "YOURCLIENTID" $ClientSecret = ConvertTo-SecureString "YOURSECRET" -AsPlainText -Force $ReportDateFrom = (Get-Date).AddDays(-100).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") $ReportDateTo = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") $DateTimeFormat = "dd/MM/yyyy HH:mm" # Date/Time Format (e.g., "dd/MM/yyyy HH:mm" or "MM/dd/yyyy hh:mm tt") $SessionTypes = "PolicyBackup,PolicySnapshot,PolicyArchive" # Session types (comma-separated, e.g., "PolicyBackup,PolicySnapshot,PolicyArchive")
3.- HTML Report and Email Delivery
The script builds a fully responsive HTML table and sends it as an attachment via Microsoft Graph API, saving you hours of manual reporting.
Conclusion
Solving real-world requests via API-driven automation is always satisfying. Hopefully, this script makes your reporting and auditing tasks simpler until native features arrive in future versions of Veeam ONE or Veeam Backup for Azure.
Give it a try and let me know your thoughts.
Leave a Reply