How to configure OAuth authentication for Microsoft 365 email in EventSentry?

Article ID: 563
Category: Configuration
Updated: 2026-09-18

This guide provides step-by-step instructions to configure OAuth 2.0 so that EventSentry can send email alerts through a Microsoft 365 mailbox.

Prerequisites

  • EventSentry v6.0 or later
  • A Microsoft 365 tenant with a licensed mailbox to send from
  • An account with permission to create app registrations and grant admin consent in Microsoft Entra ID
  • A browser on the machine running the EventSentry Management Console (the sign-in step opens locally)

Steps

A. Create the app registration

  1. Sign in to the Azure portal and navigate to Microsoft Entra ID > App registrations.
  2. Click New registration.
  3. Enter a Name, for example EventSentry OAuth.
  4. Under Supported account types, select Single Tenant only.
  5. Redirect URI > select Web.
  6. Under Redirect URIs, enter: http://localhost
  7. Click Register.

On the Overview page, copy the Application (client) ID (CLIENT_ID) and the Directory (tenant) ID (TENANT_ID).


IMPORTANT: Select the Web platform, not Mobile and desktop applications. EventSentry authenticates using a client secret, which makes it a confidential client. Registering the same URI under Mobile and desktop marks the application as a public client, and Microsoft will then reject the secret. Sign-in will appear to succeed, but EventSentry will report 401 Unauthorized.

B. Create a client secret

  1. In the app registration, go to Certificates & secrets.
  2. Select the Client secrets tab and click New client secret.
  3. Enter a description and select an expiry period.
  4. Click Add.

Copy the value shown in the Value column and save it (CLIENT_SECRET). Note the expiry date. Email delivery will stop when the secret expires, and the secret must be renewed and re-entered in EventSentry

IMPORTANT: Copy the Value, not the Secret ID. The Value is displayed only once; if you navigate away from this page you cannot retrieve it and will need to create a new secret. Confusing these two values is the most common cause of a 401 Unauthorized error later in this guide.

C. Add the API permissions

  1. In the app registration, go to API permissions.
  2. Click Add a permission > Microsoft Graph > Delegated permissions.
  3. Select the permissions listed in the table below.
  4. Click Add permissions.
  5. Click Grant admin consent for [your tenant] and confirm.
  6. Verify that each permission shows a green Granted status.

Microsoft Graph - Delegated:

PermissionDescription
Mail.SendSend mail as the signed-in user
offline_accessIssues a refresh token so EventSentry keeps sending without repeated sign-ins
SMTP.SendSend mail via SMTP AUTH
User.ReadSign in and read the signed-in user's profile

Office 365 Exchange Online - Delegated:

PermissionDescription
Mail.SendSend mail as a user through the Exchange Online API

Note: If "Office 365 Exchange Online" does not appear under APIs my organization uses, search instead for its application ID: 00000002-0000-0ff1-ce00-000000000000. If that also returns no match, the service principal is not provisioned in your tenant.

D. Use the credential in the EventSentry Management Console.

  1. Open the EventSentry Management Console.
  2. Navigate to the desired email action and select "Use OAuth..."
  3. Add a new credential (+) and enter an Account Name.
  4. Complete the fields using the values:
FieldValue
Client IDCLIENT_ID
Client secretCLIENT_SECRET
Server Auth Urlhttps://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/authorize
Server Token Urlhttps://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/token
Scopeoffline_access Mail.Send

Note: Replace TENANT_ID in both URLs with your Directory (tenant) ID.

Then click Initialize to open a browser window and log in with your credentials. Once logged in, you should see an "Authorization Successful" message in your browser and an "Authentication OK" status in the EventSentry Management Console.

E. Verify

Finish setting up your Email Action and use the "Send Test Email" option within the action. You should receive an email similar to this:

Related articles:

How to enable API access to Microsoft Entra ID (AzureAD)?
Documentation: Authentication



Try EventSentry on-premise

FREE 30-day evaluation

Download Now