Only show these results:

Office 365 Service Accounts Setup or Exchange Online

Role Propagation Delay

Depending on the configuration of an Exchange server's "Information Cache", adding the Service Account (Impersonation) role to an account can take up to two hours to update.

  1. Sign in to your Office365 administrator account.
  2. Navigate to the Admin center.

Office 365 Admin Center

  1. Expand the "Users" section.
  2. Select "Active users".
  3. Click "Add a user".
  4. Fill out the details for this user.

Office 365 Admin Center Add User

  1. Make sure to select “Let me create the password” and uncheck “Require this user to change their password when they first sign-in”.

Office 365 Admin Center Let me create the password

  1. Assign a license to the new user

Office 365 Admin Center assign license to user

  1. In the "Optional settings" screen, you can leave the settings as they are.

Office 365 Admin Center optional settings

Give Account Permissions

  1. If Admin Centers is not visible in the sidebar. Click Show all.
  2. Select Exchange.
  3. A new window will open to the Exchange admin center. Select permissions.

Exchange admin center permissions

  1. Click on the “+” icon to add a new role group.
  2. A pop-up window for new role group will appear.
  3. Click the ‘+’ icon by Roles to add a new role to the role group.
  4. In the new window that pops up, select ApplicationImpersonation and then add ->.
  5. You new role group should look like the following image:

Exchange admin center permissions Application Impersonation

  1. Now click "+" and add a Member.
  2. Search for the account you want to give permissions to. Click "add ->", then click "OK". And you're done!

Exchange admin center permissions add member

Authenticate Office 365 Users

Aliases and Service Accounts

Authenticating users with service accounts requires the original account instead of an alias. The domain names for the service account and the user must match. For example, if the service account credential was created under @contoso.com but the user account is @bravo.com, it will fail.

OAuth or Microsoft Modern Auth

To authenticate user@example.com using a service account's credentials, pass the service account's refresh token in the settings object and be sure to indicate that the credentials belong to a service account by including the "service_account": true field. In the example below, email_address contains the email of the user account that will be authenticated. The settings object contains the service account's credentials.

curl -X POST https://api.nylas.com/connect/authorize -d '{ 
"client_id": "nylas_client_id",
"name": "Nyla the Cheetah",
"email_address": "nyla@nylas.com", # Account to authenticate
"provider": "exchange",
"settings": {
"microsoft_client_id": "{microsoft_client_id}",
"microsoft_client_secret": "{microsoft_client_secret}",
"microsoft_refresh_token": "{microsoft_refresh_token}", # Service account refresh token!
"redirect_uri": "https://example.com/redirect",
"service_account": true,
"eas_server_host": "server.host.com" #optional if autodiscovery fails. Specify the eas host.
},
"scopes": "calendar"
}'

Password Authentication or Microsoft Basic Auth

To authenticate user@example.com using a service account's credentials, pass the service account's credentials in the settings object, and be sure to indicate that the credentials belong to a service account by including the "service_account": true field. In the example below, email_address contains the email of the user account that will be authenticated. The settings object contains the service account's credentials.

curl -X POST https://api.nylas.com/connect/authorize -d '{
"client_id": "nylas_client_id",
"name": "Nyla the Cheetah",
"email_address": "nyla@nylas.com", # Account to authenticate
"provider": "exchange",
"settings": {
"username": "username", # Service account username
"password": "password", # Service account password
"service_account": true,
"eas_server_host": "server.host.com" #optional if autodiscovery fails. Specify the eas host.
}
"scopes": "calendar.read_only"
}'