Some months ago I built a cloud flow that watches a table in SQL Server. It triggers via "When an item is created (V2)", performs very simple data validation and sends me an email if a record doesn't pass validation. It triggers roughly 100 times a day and rarely does it need to send me an email. This simple flow served me well.
Baring my soul here... I accidently truncated the SQL Server table. Fuming from my mistake I restored the table from a backup - completely forgetting about the flow. Then the emails started piling up in my inbox. Head smack! I should have turned off the flow before the restore!!! I'm now realizing with the restore of over 100K records I spawned that many flows. ARG! I turned the flow off but it was too late.
I set about to kill all the spawned flows. The GUI limits me to killing only 20 at a time. Research led me to this solution based on PowerShell and the M365 toolset. After some tweaking I was able to run it to completion, but noted it killed only 9K flows. I ran it again and it couldn't find any flows in the "Running" state to kill. Thinking I was in the clear I turn the flow back on. Sure enough later in the day I started getting more emails & the flow's Run History was full of "Running" flows. Again I turned the flow off, but am at a loss as to how to clean this mess up. Suggestions?
BTW I try to run the PowerShell again but now get this error:
Error: invalid_grant: AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '797fxxx-ba00-4fd7-ba43-dac1f8fxxxx'. Trace ID: a476be30-4b5d-4a1c-b1cc-44402xxxxxx Correlation ID: 863e30ed-2020-4422-af66-8f5f2xxxxxx Timestamp: 2023-12-02 17:25:54Z