Azure DevOps has support for the below two types of notifications
- Org/Project Level notifications. You can view all the various types here
- 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.
You need to store all notification emails in a Common Email box (ex: email@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.
Setup and Requirements
Create the below.
- Create two critical pipelines named Pipeline1 and Pipeline2
- 1st pipeline would have one PowerShell task and it always gets succeeded
- Initially 2nd pipeline will fail.
- Subsequently, 2nd pipeline will get Partially Succeeded.
- Finally, 2nd pipeline will get succeeded
- Create a non-critical pipeline named Pipeline3 for which you don’t need any notifications to the custom e-mail address.
- 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.
- If the Definition Name of the Pipeline is Pipeline1
- If the Definition Name of the Pipeline is Pipeline2
- If Pipeline1’s Status is Succeeded, Partially Succeeded or Failed
- If Pipeline2’s Status is Succeeded, Partially Succeeded or Failed
Navigate to the Project Settings, click on the Notifications tab and then click on the New Subscription as shown below.
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.
In the next step, configure the following.
- Feel free to change the Description.
- In the Deliver to field, choose Custom email address and provide the email box in the Address field
- In the Filter field, choose the A specific team project and select your project (it should be automatically set)
- In the Filter criteria field, choose the below filters.
- We would like to receive notifications for both Pileline1 and Pipeline2. So, choose Or as shown below.
- 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.
- Once you click on the Group selected clauses the checkbox selection will be cleared and the grouping will be shown as shown below.
- Now, we need to add more conditions on when to receive the notifications. Add more clauses by clicking on + Add new clause.
- As shown in the above screenshot, create another group for all the conditions separated by Or and click on Finish.
In this article, we have learnt how to configure custom notifications using Custom notification Subscription.
Feel free to provide feedback using the comments section.
Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups