I have the same issue
latest osTicket on Ubuntu 18. Remote Mailbox with OAuth2 - Microsoft, secret, redirect URL, etc, all looks okay, but the Outgoing SMTP dialog working. It errors with "5.7.3 Authentication unsuccessful [LO2P123CA0057.GBRP123.PROD.OUTLOOK.COM]"
Authentication: OAuth2- Microsoft (or same as Remote Mailbox) which is okay
Azure AD has App Registration, redirect URL, secret, and so on, which is why the OAuth2 is okay for remote mailbox.
Azure AD API permissions also has the SMTP.Send delegated and Mail.ReadWrite delegated, and so on.
Microsoft 365 admin center -> Users -> Active users, the mailbox/user, Mail -> Manage email apps, has "Authenticated SMTP" ticked. Tried with and without tick. Still no luck. Leaving it ticked.
I originally tried using the host of [ourcompany].onmicrosoft.com, but that failed with PHP get_file_contents() returns "no address associated with hostname", so realised that was no good as it didn't ping/resolve. Checking Microsoft 365 admin center shows no MX records either for that, so tried one of the other domains, which has MX record, and then it just says Could not open socket, connection timed out. Tried with ssl:// and tls:// and various combinations of. Still no luck.
So switched and tried outlook.office365.com and smtp.office365.com for host. They resolve, but now get authentication unsuccessful as per
"5.7.3 Authentication unsuccessful [LO4P123CA0610.GBRP123.PROD.OUTLOOK.COM]"
I think it's due to smtp.office365.com being the generic 365 mailbox, but we have Microsoft 365 Business Standard, hence in other places it refers to [ourcompany].onmicrosoft.com
Wondering about creating a new mailbox as per norternnoel above, with a new email/mailbox. Luckily have a spare licensed mailbox to use.