large

I’ve recently setup Azure Backup for a customer and they wanted to be notified when/if a failure happened on a VM and it was unable to Backup

Currently this can only be done via PowerShell and not in the Portal

</pre>
# Script Created by Craig Cloud IT Pro v.01 #

#

# This script will create an Email Alert to send an email when a backup job has failed #

#

# Import Azure Module #

Import-Module AzureRm

# Login to your Azure Account or Select your Profile #

# Login-AzureRmAccount

Select-AzureRmProfile -Path "C:\Scripts\#azureprofile.json"

# Input the User or Distribution List you wish to send too #

$actionEmail = New-AzureRmAlertRuleEmail -CustomEmail "craig.fretwell@trustmarque.com"

# Create the Alert Rule #

Add-AzureRmLogAlertRule -Name "Backup Failed" -Location "West Europe" -ResourceGroup "CF-ASR-Home" -OperationName "Microsoft.RecoveryServices/recoveryServicesVault/Backup" -Status "Failed" -TargetResourceId "/subscriptions/yoursubscriptionID/resourceGroups/CF-ASR-Home/providers/Microsoft.RecoveryServices/vaults/CF-ASR-RSV" -Actions $actionEmail

# Delete the Alert Rule if you no longer need it #

Remove-AzureRmAlertRule -ResourceGroup "CF-ASR-Home" -Name "backupFailedAlert"
<pre>

backupfailure

Advertisements