We recommend connecting Office365 mail to Bitrix24 using application passwords. Application passwords are long, randomly generated passwords. They are specified once instead of the default password to log in to applications and devices that do not support two-factor authentication.
Application passwords in Office365 only work when two-factor authentication is enabled. You can turn it on in your Microsoft account in Security section > Advanced Security Settings.
Turn Two-step verification on and follow the instructions.
When a two-step verification is enabled, you can create application password.
Click Create a new app password and get a unique password.

Here you can also Create a new app password or Remove existing app passwords.
Connecting to Bitrix24
Go to Bitrix24, choose Office365 and specify the necessary connection details: email, login and password for the application.
To connect to outgoing mail through the Office365 servers, tick the option Send using external SMTP.
Click Connect button to complete the settings.
Bitrix24 On-Premise version
Office365 inbox is configured in the same way in Bitrix24 On-Premise version.
Outgoing mail is configured by the system administrator on the server where Bitrix24 is installed.