Important prerequisite: The following steps should be executed inside the Azure AD application which is created according to the instructions from the Set Up of the Azure AD Application
- Request API Permissions
- Select APIs my organization uses
- Select Office 365 Exchange Online as shown in the screenshot
- Choose Application permissions, then full_access_as_app
- Add permissions, then Grant admin consent!