Open Authentication setup
Go to
Mail conversation -> OAuth options
Set required variables
For application to work correctly application has to have these permissions
Microsoft Azure application permissions
While setting up a mailbox save mailbox settings first without entering a password. After you save a mailbox you can click Sign in with Microsoft
Sample configuration