Forum Discussion
Trigger Alerts Notification for successful/failed Pipelines
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 Name | Master Pipeline Name | Pipeline Name | Invoke Pipeline Name | Pipeline ID | Status | Error Message |
| PL_Parameter_ | Main Pipeline | Invoke pipeline1 | PL_Parameter_ | xyz-abc | Failed | {Error_Message_will_be_displayed} |
| PL_Parameter_ | PL_Parameter_ | Invoke pipeline1 | PL_Test_1 | efg-fhi | Failed | {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
Also, we are only looking to integrate this as a complete Fabric solution (we don't want to use Azure).
- v-saisrao-msft1 year ago
Community Support
Hi Anonymous
Thanks for the detailed context you're on the right track with using a notebook and Fabric APIs. To convert your DataFrame output into a format suitable for the Outlook activity, I recommend using df.to_html(index=False) within your notebook to transform the DataFrame into an HTML table string. You can then pass this HTML string using mssparkutils.notebook.exit(), capture it in a Set Variable activity, and use it as the email body in your Outlook activity (assuming it supports HTML content). This approach maintains formatting and ensures readability in email notifications. Regarding SMTP, FabricRestClient currently doesn’t support credential-free SMTP directly. If avoiding username/password is critical, consider using the Outlook activity (if supported in your tenant) or triggering a webhook to Power Automate for notifications, which provides secure and flexible email delivery without handling credentials directly.
If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you.