Azure DevOps – Tips and Tricks – 2 – Pipeline Notifications – Custom notification Subscription.

Azure DevOps has support for the below two types of notifications

  1. Org/Project Level notifications. You can view all the various types here
  2. Personal notifications – Each individual user can manage their Personal Notifications.

The above two options send notifications only to the members of Azure DevOps. Think about a scenario where you would like to send notifications to anyone who is not part of Azure DevOps?

Azure DevOps also has support for configuring Custom notifications. In this article, we are going to learn about how to configure Custom notifications for any specific event or scenario using a feature called Custom Notification Subscription.

Scenario

You need to store all notification emails in a Common Email box (ex: logpipelinenoticiations@example.com) to audit all the Failures or Partially Succeeded pipeline executions.

May be, you may want to store these notifications ONLY for most critical pipelines instead of all the pipelines for a given ADO Team Project.

Let’s learn how to implement this scenario.

Advertisements

Setup and Requirements    

Create the below.

  1. Create two critical pipelines named Pipeline1 and Pipeline2
    1. 1st pipeline would have one PowerShell task and it always gets succeeded
    1. Initially 2nd pipeline will fail.
    1. Subsequently, 2nd pipeline will get Partially Succeeded.
    1. Finally, 2nd pipeline will get succeeded
  2. Create a non-critical pipeline named Pipeline3 for which you don’t need any notifications to the custom e-mail address.
  3. In order to receive Create Custom Notification Subscription which sends e-mail notification to a custom e-mail address when the below conditions are met.
    1. If the Definition Name of the Pipeline is Pipeline1
    1. If the Definition Name of the Pipeline is Pipeline2
    1. If Pipeline1’s Status is Succeeded, Partially Succeeded or Failed
    1. If Pipeline2’s Status is Succeeded, Partially Succeeded or Failed

Solution:

Advertisements

Navigate to the Project Settings, click on the Notifications tab and then click on the New Subscription as shown below.

Azure DevOps Tips & Tricks – Notifications – New Subscription

In the new Subscription tab, as you can see there are quite a few Categories for which you can configure Custom notifications. Our interest is on Build notifications.

As shown below, chose Build option in the Category and then choose A build completes in the Template list and then click Next.

Advertisements
Azure DevOps Tips & Tricks – Notifications – New Subscription – Build Completes

In the next step, configure the following.

  1. Feel free to change the Description.
  2. In the Deliver to field, choose Custom email address and provide the email box in the Address field
  3. In the Filter field, choose the A specific team project and select your project (it should be automatically set)
  4. In the Filter criteria field, choose the below filters.
    1. We would like to receive notifications for both Pileline1 and Pipeline2. So, choose Or as shown below.
Advertisements
Azure DevOps Tips & Tricks – Notifications – New Subscription – Build Completes
  • As we are creating only one subscription for getting notifications for both pipelines, we need to take care of the below.
    • Choose Or condition
    • Group both the filters by selecting the checkboxes and clicking on the Group selected clauses as shown below. Please note this icon is enabled only when you select at least one filter by clicking on the respective checkbox.
Advertisements
Azure DevOps Tips & Tricks – Notifications – New Subscription – Group Filter Clauses
  1. Once you click on the Group selected clauses the checkbox selection will be cleared and the grouping will be shown as shown below.
Azure DevOps Tips & Tricks – Notifications – New Subscription – View Group Filter
Advertisements
  • Now, we need to add more conditions on when to receive the notifications. Add more clauses by clicking on + Add new clause.
Azure DevOps Tips & Tricks – Notifications – New Subscription – View Group Filters – Finish
  • As shown in the above screenshot, create another group for all the conditions separated by Or and click on Finish.

Conclusion

In this article, we have learnt how to configure custom notifications using Custom notification Subscription.

Feel free to provide feedback using the comments section.

Advertisements

Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups

WhatsApp

Telegram

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s