Send mail via M365 through PowerShell without compromising my Entra AD
I have been struggling with this for a while and maybe someone can provide me with some guidance. I have a bunch of scripts which run on my server periodically. At the end of the run I would like the scripts to send an email to an address in my M365 organization.
To do so I try to do an SMTP auth via PowerShell to one of my mailboxes (to use as a sender).
This fails with: