We’ve covered how using a PowerShell script might come in handy for certain use cases. Now, let’s take the PowerShell script and show how it can be backed into your day-to-day Veeam Backup & Replication jobs.
In this post, we will cover how these scripts can be run before and after the backup job. This would allow us to take the most recent backup and convert it straight into an Azure Virtual Machine after the backup job is done. This means we can schedule the backup job to start within a certain window and get this machine (or a group of machines) converted before your test/development team is even in the building.
The use case
This specific use case I keep mentioning is around test and development. There are no hard rules on this, anything that could take advantage of cloud computing within Azure is a valid use case. For example, taking advantage of an isolated environment to perform modern analytics against the most current backup data or for training and development to certain areas of the business. The possibilities are endless.
You saw in the last post the creation of the raw PowerShell script, by taking that script and adding that to a backup job as pre- and post-job scripts which give us the ability to schedule a conversion task. The time it takes to convert to that Azure VM or that group of Azure VMs depends on the backup file placement.
Adding the script to the job
We want to firstly run through creating a new backup job or using an existing backup job. On the “Storage” step of the settings you have an “Advanced” button, by selecting it and going to the “Scripts” tab, you can specify your pre- and post-job scripts. Another interesting concept here is an ability to pick either a number of times you want to run these scripts or certain days to run them on.
The concept of the pre-script is the clean-up script mentioned in the first post. The idea here is that we may not want to duplicate multiple instances within our Azure environment. If we do then maybe we just remove this script completely. What this script is going to do is power down and remove any of our provisioned resources from the last run of the job. If this is the first run and there are no provisioned resources, then you will receive an exit code 1 meaning there is nothing to be removed.
This script is going to take place after the backup operation has completed. In our case, the job will take the most recent restore point and send it for conversion in our test and development environment in Azure. Once the backup job is complete, you will see a new job for conversion start within the Veeam Backup & Replication tasks.