Most of the admins and developers working on automation have built hundreds of flows in PowerAutomate but they do not get timely failure alerts so that they can resubmit the flows.
We were also facing the same issues with our ever-increasing flows and not getting the flow failure messages until later in the week.
After researching, we have devised PowerShell Magic which is helping us lately and will now help you as well
Here is the magic available for download:
Prerequisites for this solution:
Download the solution from below git hub link: (flowmonitorandalert.ps1)
Download the solution from PowerShell Gallery:
Install-Script -Name flowmonitorandalert
Script will auto generate the password first time when it runs and will save it as encrypted in the same folder.
Syntax for running the Script:
To get alert based on Owner of the flow i.e. who created the flow:
.\flowmonitorandalert.ps1 -CreatedbyGUID “86981-yjfykv-676-tdyttty” -EnvironmentName “Default-f9u09-7587-6576d-87575” -smtpserver smtp.labtest.com -from firstname.lastname@example.org -erroremail Reports@labtest.com
To get alert based on Name matching of the flow i.e. if name matches particular string
.\flowmonitorandalert.ps1 -FlowNamematch “FLOWMON” -EnvironmentName “Default-f9u09-7587-6576d-87575” smtpserver smtp.labtest.com -from email@example.com -erroremail Reports@labtest.com
Here is the alert message you will receive:
Schedule this Script Every Hour, it will notify you two times for one failure, in case you miss one.
$getdate = (Get-Date).AddHours(-2)
To make it fast, Script extracts all the flow information in temp folder every day in the night at 11 PM, every other time it will just read from it.
I hope this magic will assist you in case you are also looking for a script that can alert you when the flow fails.
Thanks for reading and downloading….