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:
535 5.7.139 Authentication unsuccessful, user is locked by your organization’s security defaults policy. Contact your administrator
As a first solution I executed this on my M365 account:
Set-CASMailbox -Identity <EmailAddress> -SmtpClientAuthenticationDisabled $false
That did not change/solve the error.
After researching some more the only solution I was able to find is to turn off Azure Security Defaults. However that seems to have some red tape involved.
Is there not a solution for this that won’t make me feel like I leave the front door open on my Azure AD / Entra AD?
Best regards