What's the better way to do alerting?

I used to have a PowerShell script that I scheduled to run at the start, and end of the work-day. The script would login as the ‘alert’ email account to 365 with an app password, and enable (or disable) a mailbox rule to forward new emails [from specified domains] as a text message to my phone.

Having removed legacy authentication in our azure tenant, app passwords no longer work, so to enable/disable the forwarding, each time, a person - or I - would have to manually enter the MFA code for the script. [at least, I think that’s the only way, after fruitlessly googling "modern authentication 365 powershell "… right?]

What’s the better way of doing this? Outlook and Flow [power automate] seem pretty hit and miss. My method worked best at the time, because I could:

  • Filter to decide which domains I wanted to be alerted on, and not get notifications for every piece of spam mail
  • Set a schedule for when I should be sent a text message
  • Relying on Outlook and Flow apps -- sometimes the processes stop running, or go to sleep on my phone, and no longer push notifications unless I actively check
As far as I know, there isn't a way to schedule outlook rules based on time in the owa, so this was my (likely) overkill solution.