Azure Report

Recently Jorge De La Cruz posted a method of creating and sending a job report from Azure.

Veeam: HTML Daily Report for Veeam Backup for Azure is now available – Community Project – The Blog of Jorge de la Cruz

I followed in fashion with creating an adaption of that report by using Golang as I’m a big fan of the language.

https://github.com/shapedthought/veeam_azure_assessment

I’ve not been able to make my version as pretty as Jorge’s and parsing the strings for some of the outputs has proven to a bit of challenge in Go.

However, in my opinion Jorge’s report has issues as it is a shell script so you need a Linux VM and the email functionality needs some work in my opinion.

Anyway, what I decided to was to combine our efforts by creating a Docker image based on Ubuntu. It has the script (slightly modified) embedded as well as all the required packages (curl, jq), plus a Golang executable that I wrote which takes advantages of the languages native SMTP support.

The images is available from: txtxx56/azure_report

You will need to create an .env file with the following:

VEEAMUSER=username
VEEAMPASS=password
VEEAMURL=https://55.55.55.55
SMTPTO=their@emailaddress.co.uk
SMTPFROM=your@emailaddress.co.uk
SMTPSERVER=your.smtp.com
SMTPPASS=sMtpPaSSwOrd

You can then run the container using the following:

docker run --rm --name azure_report --env-file ./.env txtxx56/azure_report:0.5

You should see “Sending Email” then “Email Sent” if it worked correctly.

If you want to get a local copy of the HTML report run the following:

docker run --rm --name azure_report --env-file ./.env -v ${pwd}/target:/home/oper/vba_azure_reports txtxx56/azure_report:0.5

You will need to update the local target name, for example in the folder that I run this from I have a ‘report’ directory so map the bind mount to that.

My plan is to take this step further and create a Kubernetes CronJob which will leverage a Secret and ConfigMap. It is possible do secrets in Docker Swam but as there is no way to schedule the running of a container, so I decided that K8s is a better option.