UPDATE April 19, 2024: Exchange team made announcement of retiring Application Impersonation. From May 2024 you will not be able to assign this role, and from February 2025 this role and all its features will be removed.
Create an impersonation user to be able to connect Microsoft Office 365 via Exchange Web Services.
Impersonation is an option when you're dealing with multiple mailboxes because you can easily grant one service account access to every mailbox in the database. Delegation and folder permissions are convenient only when you're granting access to a few selected users because you have to add permissions to each mailbox individually. For more information see Microsoft.
To create an Impersonation user
Login to Exchange Admin Center.
Select Permissions on the left.
Click on +.
Add a Role.
Select ApplicationImpersonation.
Click on Add.
Click on OK.
Add Members.
Select Service.
Click on Add.
Click on OK.
Click on Save.