Deploying Veeam Backup for Microsoft Office 365 using Terraform

Deploying Veeam Backup for Microsoft Office 365 using Terraform

For quite some time I have been working with Veeam Backup for Microsoft Office 365. While version 1 was just designed for Exchange backup, things have changed at a rapid rate over the past few years. Ever since the introduction of the RESTful API in version 1.5, I have been hooked.

With every available version, I had to assure my Self-Service web portal would work but also support new features. This means a lot of installations with different versions and build. Think about builds like beta, RC, RTM, and GA.

In general, every new build would mean the following:

  • Install Windows server
  • Configure firewall
  • Install Veeam Backup for Microsoft Office 365
  • Install Veeam Explorer for Exchange
  • Install Veeam Explorer for SharePoint/OneDrive for Business
  • Configure RESTful API service

To speed up things, I decided to automate this by leveraging PowerShell and Terraform. For the ease of use, I will split this blog post into 2 sections. The first section will cover a PowerShell script you can use while the second section will go over a Terraform example within AWS.

Keep in mind this PowerShell script is used for more advanced configurations and is an all-in-one unattended deployment script. If you prefer to use Chocolatey, Maurice Kevenaar recently published a package. Keep in mind this package is just for the installation of the components and there are no additional options such as installing a license or configure the RESTful API service.

Another good thing to know about this! This is the same code we leveraged within Project Martini (which contains a PHP wrapper to create Terraform JSON configuration files).

Unattended deployment script

Big credits to Timothy Dewin for making the initial script that got updated.

The script is available via GitHub and will do the following:

  • Download the latest Veeam Backup for Microsoft Office 365
  • Install Veeam Backup for Microsoft Office 365
  • Install Veeam Explorer for Exchange
  • Install Veeam Explorer for SharePoint/OneDrive for Business
  • (OPTIONAL) Apply the license file
  • Configure RESTful API service
  • Configure Tenant Authentication Settings
  • Configure Firewall rules for Veeam Backup for Microsoft Office 365 services (RESTful API service & console)

To use this script, you have to perform the following steps:

  • Create a folder: C:\VBO365Install
  • Store the PowerShell script in there
  • To install a license, you will need to store your license file in the same folder and rename it to veeam_backup_microsoft_office.lic
  • Run the script

Combining it all with Terraform

As I said in my introduction, I tend to deploy multiple builds per release and to speed this process up I use Terraform. I rather not spend too much time configuring and installing a Windows server over and over again.

The following examples posted on GitHub are created for AWS however you can modify this and use it within Azure, VMware vSphere…

The examples leverage access key with a secret key as well as a key pair to decrypt the Windows Administrator password (change it once done). Keep in mind that these are basic examples and you will want to modify this to your needs.

By using the example the following happens:

  • A Windows 2016 or 2019 server EC2 instance is deployed within AWS
  • A security group is configured which opens several ports (3389 (RDP), 5986 (WinRM), 4443 (RESTful API service), 9191 (Veeam Backup for Microsoft Office 365 console port) – by default this will be configured for 0.0.0.0/0 so change this to your IP (range)
  • Run the unattended install script

To use it within AWS, you will have the perform the following steps:

  • Create an IAM role for Terraform with permissions to deploy EC2 instances and security group
  • Create a key pair in your desired region
  • Save the key in the setup folder
  • Open AWS.tf and configure your access_key and secret_key
  • To install a license, you will need to store your license file in the setup folder and rename it to veeam_backup_microsoft_office.lic
  • Terraform init
  • Terraform apply

You can find the code via my GitHub, respectively:

If you don’t need the additional settings such as configuring a license or enabling the RESTful API service, I suggest you use Chocolaty and just leverage “choco install veeam-backup-for-microsoft-office-365“.

If you have feedback or improvements, feel free to share them or make a pull request on GitHub!

Comments are closed.