Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Trigger Alerts Notification for successful/failed Pipelines

Hi Community!

 

I have a scenario where I have a master pipeline which has multiple child pipelines within it. 

For Example:

Pipeline A
Child pipeline(Pipeline A) - Pipeline B
Child pipeline(Pipeline B) - Pipeline C

 

Pipeline A has some activities and is then connected to a child pipeline Pipeline B, Pipeline B has few activities with another child pipeline Pipeline C. Now these pipelines are interconnected and have dependencies. I want to ensure that I get an email notifications triggered upon successful/ failed runs. I did find some solutions in the community but none of them suits my scenario. Also I have complicated pipelines, therefore I cannot work on below scenarios as well(includes too many activities/ doesn't suit my scenario):
https://www.c-sharpcorner.com/article/error-logging-and-the-art-of-avoiding-redundant-activities-in-msft-fabric-data-p/

https://community.fabric.microsoft.com/t5/Data-Pipeline/Monitor-pipeline-runs-with-alerts/m-p/4141013 

 

I was thinking of using a single notebook activity and using Fabric API's to parameterize my pipelines and capture logs and use email notifications. However, I thought there might be better solutions. 

Please let me know if there are any other ways.

Thanks in Advance!
Hrishi

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    To address your scenario in Microsoft Fabric, where you have a master pipeline with multiple interconnected child pipelines and want to trigger email notifications upon success or failure, here are some potential solutions:

     

    Using Fabric API with a Notebook Activity
    Your idea of using a single notebook activity to parameterize pipelines and capture logs is a good approach. Here's how you can implement it:

     

    Use the Fabric API to monitor pipeline runs programmatically.
    Create a notebook activity in your pipeline that:
    Fetches the pipeline run status using the Fabric API.
    Logs the status (success/failure) for each pipeline and its child pipelines.
    Sends an email notification using an SMTP library (e.g., Python's smtplib) or a third-party email service like SendGrid.
    Parameterize the notebook to handle different pipelines dynamically.

     

    Using Webhooks for Notifications
    You can use webhooks to trigger notifications based on pipeline events.

     

    Configure a webhook in Microsoft Fabric to listen for pipeline run events (success/failure).
    Use a service like Azure Logic Apps, Power Automate, or a custom webhook handler to process the event and send email notifications.
    Ensure the webhook is triggered for both the master and child pipelines.

     

    Custom Logging and Notification Pipeline
    Create a separate pipeline dedicated to logging and notifications.

    At the end of each pipeline (master and child), add an activity to log the run status to a centralized location (e.g., Azure Blob Storage, SQL Database).
    Trigger the logging and notification pipeline after the master pipeline completes.
    The logging pipeline reads the run statuses and sends email notifications.

     

    Using Azure Monitor Alerts
    Leverage Azure Monitor to track pipeline runs and send alerts.

    Enable diagnostic settings for your pipelines to send logs to Azure Monitor.
    Create an alert rule in Azure Monitor to trigger on specific conditions (e.g., pipeline failure).
    Configure the alert to send email notifications.

     

    Combining Fabric API and Logic Apps
    If you want a more robust solution, combine the Fabric API with Azure Logic Apps.

     

    Use the Fabric API to fetch pipeline run statuses.
    Trigger a Logic App workflow to process the statuses and send email notifications.
    Schedule the Logic App to run periodically or trigger it from the pipeline.

     

    Regards,

    Nono Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous ,

       

      Thank you for the logic, I happen to use notebook at pipeline run time by using a wait activity(as the status might take some time to reflect since we are using API). I happen to use the notebook during pipeline run where I fetch my latest run. I am able to extract this. However, I am trying to use Outlook activity to push the notification. The issue is I am not sure how to convert my string output to Table.

      This is the structure of my notebook df output:

      Main Pipeline NameMaster Pipeline NamePipeline NameInvoke Pipeline NamePipeline IDStatusError Message
      PL_Parameter_Main PipelineInvoke pipeline1PL_Parameter_xyz-abcFailed{Error_Message_will_be_displayed}
      PL_Parameter_PL_Parameter_Invoke pipeline1PL_Test_1efg-fhiFailed{Error_Message_will_be_displayed}


      I am using mssparkutils to capture this notebook output(exitValue) as a string and pass it to set variable(optional) then to Outlook activity. But since it is string, I am not sure how I can convert this string to table.

      Also, if we want to use SMTP, can I use FabricRestClient instead of passing username and password.
      Can you please share a sample structure for SMTP code as I don't want to pass username and password.

      Thanks in advance!
      Hrishi

      • Anonymous's avatar
        Anonymous
        Not applicable

        Also, we are only looking to integrate this as a complete Fabric solution (we don't want to use Azure).

  • Anonymous's avatar
    Anonymous
    Not applicable

    cant we use power automate for this ? 

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,
    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous,

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-saisrao-msft's avatar
    v-saisrao-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.

     

    Thank you.