0

I successfully ran PowerShell script for calling the Power BI REST APIs following this instruction from Github. https://github.com/Azure-Samples/powerbi-powershell

Does somebody know a way to send an email alert when the process above finish? Like sending out an alert of the result of the refreshing. Please help!

  • The last line of [rebindReport.ps1](https://github.com/Azure-Samples/powerbi-powershell/blob/master/rebindReport.ps1) calls [Invoke-RestMethod](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-6) and returns the content as objects. You can pipe that output to a JSON string and send that as an [SMTP message](https://stackoverflow.com/questions/33751519/powershell-email-how-to-send-email-with-high-importance). – Rich Moss Oct 09 '19 at 19:50
  • Hi Rich Moss, thanks for the comment. I am trying to refresh the dataset by calling Rest API using PowerShell script (https://github.com/Azure-Samples/powerbi-powershell/blob/master/manageRefresh.ps1). What I want to do is to get an email notification after the dataset refreshed. I tried to put this in the script $body = @{ "notifyOption"= "MailOnFailure" } $restResponse = Invoke-RestMethod -Uri $restUrl –Method POST -Headers $headers -Body $body – Salina Sok Oct 09 '19 at 20:35
  • Sorry for slow response, Salina. I was hoping that someone with a Power BI environment would respond, as I can't test. You might want to close this question and re-post it with the sample code that doesn't work, and a link to the documentation where you found the notifyOption. There is a [PowerBI](https://stackoverflow.com/questions/tagged/powerbi) tag you could add that would get a more focused group. – Rich Moss Oct 14 '19 at 17:05

0 Answers0