Blogs / Microsoft / Azure / Email Notifications in Azure

Email Notifications in Azure

Apr 4, 2019

SHARE

Email notifications are crucial to ensure the health of your Azure environment and processes. Azure supports email notifications to send alerts that monitor its resources and events. There are numerous methods in Azure to send email alerts. Below are a few common approaches:

  • Azure Logic App
  • Azure Automation Runbook

Azure Logic App

Azure Logic App is a cloud-based service which supports a feature to send email notifications through multiple services such as Outlook and Gmail.

Use Case

A simple approach to send an outlook mail when a blob in the storage account is added or modified:

  1. Create a logic App resource within a resource group.
  2. Add a Trigger event as “When a blob is added or modified (properties only)” from Azure Blob Storage event
  3. Add an action “Send an email” from Office 365 Outlook event and create a connection with your outlook ID
  4. Specify the following Parameters:
    • Required Parameters
      • Body
      • Subject
      • To
  • Optional Parameters
    • Attachments
    • BCC
    • CC
    • From (Send As)
    • Importance
    • Is HTML
  1. Dynamic Content can be provided to parameters based on the output of previous steps

Logic App Designer

Email Notifications in Azure

Azure Automation Runbook

Azure Automation Runbook is a cloud-integrated user interface to develop PowerShell scripts. Using an SMTP configuration from a PowerShell script we can send email alerts to the users.

SMTP Configuration for outlook:

SMTP server namesmtp-mail.outlook.com
SMTP port587
SMTP encryption methodSTARTTLS

Use Case

Email alerts when a pipeline run has failed with error details:

  1. Build an Azure automation runbook with SMTP Configuration for outlook server with the below script
  2. Configure a webhook for the runbook (Copy the webhook URL)
  3. In Azure Data Factory,
    • Build a Pipeline with a required activity
    • Handle Failure event with a web activity
Email Notifications in Azure
  • In settings configure the properties as shown below.
  • In this demo, Pipeline name, Activity start time, Activity status, Error and Error description is captured. The recipient and subject are also passed through the pipeline. If there are multiple recipients, pass the values in parenthesis. For Reference,(‘XXX@XYZ.com’, ‘YYY@XYZ.com’)
Email Notifications in Azure

Note: Failure Event is precise to a single activity. So, if there are 2 or more activities in your pipeline then for each activity, Failure events should be handled individually because Dependency between activities is Logical AND.

4. Whenever pipeline activity gets failed, ADF will invoke azure automation runbook through webhook and send error details.

  • Create an automation account and build a PowerShell runbook with the below code.
  • Update your Azure credentials in the automation account and pass the credential name in the code
Email Notifications in Azure

5. Mail body can contain normal text or HTML content. Here the body is crafted with HTML along with a hyperlink

6. The following mail is produced by the above runbook whenever a pipeline activity fails

Email Notifications in Azure

Learn more about Visual BI’s Microsoft Azure offerings here.


Corporate HQ:
5920 Windhaven Pkwy, Plano, TX 75093

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com


Copyright © Visual BI Solutions Inc.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This!

Share this with your friends and colleagues!