Blog

Veeam Backup as Code

last updated on 2018-05-22

Large Veeam Backup & Replication deployments require quite a bit of guidance. That's why we as Solution Architects have a job. For the last few years at VeeamON, I've been part of a session on Best Practices and Configuration, together with Preben Berg @poulpreben and @tdewin. For the session this year I discussed something a little bit different: 'Policy and Configuration Management'.

In reverse order, I discussed how you can automate Veeam best practices. In large deployments with 100s of jobs protecting 10K+ virtual machines, the more you can automate the better. Instead of worrying about having to interpret the Veeam Best Practice Guide you can use tools like the Environment Assessment Toolkit and Restore Point Simulator. But what if we took this a step further still? I demoed three PowerShell commandlets: Import-, Export- and Compare-VHMVBRJob, that come as part of VeeamHubModule.psm1. I also discussed a future tool that could take some of these concepts and create a dedicated user interface for them.

The concept is simple. You can use the Export-VHMVBRJob commandlet to export the existing job to JSON (BCX file) and store it in version control (git) and then use it to see changes over time. You can use the Import-VHMVBRJob commandlet to overwrite changes or create a new job based on this existing configuration, and use the Compare-VHMVBRJob commandlet to selectively compare configuration with jobs in production.

Another way to get close to a policy model in Veeam Backup & Replication is to use Veeam ONE to automatically generate tags, and use these tags in combination with template jobs to automatically generate jobs with the correct retention settings for your environment. The benefit of using PowerShell is that this allows this process to scale, and you can use commandlets like Find-VBRViEntity and Find-VBRHvEntity to automatically populate the jobs you create and or modify.

The Import-, Export- and Compare- commandlets still have a way to go, and this isn't the first project to help address editing Veeam jobs at scale. Code contributions or feedback are always welcome!