Microsoft’s Azure backup client is a useful and simple way to set up offsite backups.

However, an essential part of running backups is checking that they have worked. The Azure backup client has no built-in notification functionality.

In this how-to, you will learn how to combine the event log, task scheduler, and PowerShell to send email notifications of backup events.

7 Steps total

Step 1: Email scripts

You will need to create two simple PowerShell scripts using PowerShell ISE – one to notify of success, and one of failure. Save them somewhere easy to find.

The scripts are one-liners:
end-mailmessage -from “FS01 Azure Backup <backup@company.com>” -to “Backups <backup@company.com>” -subject “FS01 Azure Backup Successful” -body “Backup of FS01 to Azure has been successful” -smtpServer smtpserver.company.com

You will obviously need to change the details to suit your environment 🙂

Step 2: Task Scheduler setup

The next step is to create tasks to monitor the event log for the relevant events.

We’ll start with the ‘failure’ event, as it’s slightly more complex.

Open Task Scheduler, and click ‘Create Task’. Give it a suitable name, select a suitable service account to run it (which will need to have admin rights on your server), and make sure to tick ‘Run whether user is logged in or not”!

Step 3: Task Scheduler triggers

Move to the Triggers tab.

Click New, and select ‘On an event’ from the drop down.

Click the ‘Custom’ radio button, then click ‘New Event Filter’

Tick the ‘critical’ and ‘error’ event level boxes, and select the event log ‘Applications and Services Logs/CloudBackup/Operational’

Finally, replace “All event IDs” with this list: “5,10,11,12,13,14,16,18”

Step 4: Task Scheduler actions

Finally, move to the Actions tab.

Click ‘New’, select ‘Start a program’ from the list, and enter ‘powershell.exe’.

In the ‘Add arguments’ box, you need to tell PowerShell to run your pre-made script: ‘-file “C:\AzureBackupEmailScripts\Failure.ps1″‘

Step 5: Repeat!

Now we need to repeat steps 2-4 to create the ‘Success’ event. This is hopefully the one you’ll be seeing more frequently!

This time, the event ID you are watching out for is ‘3’.

Step 6: Set-ExecutionPolicy

Finally, we need to make sure that PowerShell will run your scripts.

Open a PowerShell window, and type:
Set-ExecutionPolicy Unrestricted

Step 7: Test!

You can test that your email configuration works by right-clicking on your tasks and selecting ‘run’. This should fire the appropriate email into your inbox. Troubleshooting your SMTP issues is outside the scope of this how-to 🙂

You can now receive email notifications of your Azure backups, so stop worrying about them!