Configuring Email Settings

You can configure an email server so that you can send an email notification as part of an enforcement set or send a report by email.

To configure Email settings:

  1. From the top right corner of any page, click the settings icon. The System Settings page opens.
  2. In the Categories/Subcategories pane of the System Settings page, expand External Integrations, and select Email.
  3. Send emails (required, default: switched off) — Toggle on to use an Email server. A configured Email server is a prerequisite before you can configure an email notification as part of a configured Enforcement Set or configuring a report to be sent via mail.
  4. SMTP gateway — Select the Gateway to use for SMTP.
  5. Define the Email host name and Port.
  6. SMTP Authentication Type — Select the SMTP Authentication type:
    • Password Authentication
    • Azure Authentication
    • OAuth2 Authentication

Password Authentication

When you choose Password Authentication, you can configure a User name and Password (optional).


Azure Authentication

📘

Note

This method uses the Microsoft Graph API (Mail.Send) and does not use SMTP. For SMTP-based OAuth, see OAuth2 Authentication below.

Select Azure Authentication to send email using MS Graph API, and configure the following settings:

  • Client ID — The client ID from the Azure application.
  • Client secret — The client secret from the Azure application.
  • Tenant ID — The Tenant ID from the Azure application.
  • Sender address — Enter a sender address from which the mail will be sent.

For details on generating Azure Client ID, Azure Client Secret and Tenant ID, refer to the Microsoft Entra ID documentation.

Required Permissions

The Entra application must have the following application-level permission: Mail.Send or Mail.Send.Shared.

💡

Important — Security Recommendation

By default, the Mail.Send application permission allows the application to send as any mailbox in the tenant. To follow least-privilege principles, restrict the application to only the designated sending mailbox using Exchange Online RBAC:

  1. Create a dedicated Entra service principal with a client secret.
  2. In Exchange Online PowerShell, create a reference to the Entra service principal.
  3. Create a management scope that contains only the designated sending mailbox.
  4. Assign the Application Mail.Send management role to that scope.

Mailbox and Licensing Requirements

The sender address does not always require an Exchange Online license:

  • User mailbox — must have an Exchange Online license assigned.
  • Shared mailbox — can be used without a license (within Microsoft's supported limits). This is the recommended option for service-generated emails.
    Recommendation: Use a dedicated shared mailbox (for example, [email protected]) for Axonius-generated emails.

OAuth2 Authentication

📘

Note

This method uses SMTP with OAuth 2.0 (SMTP.Send) via Microsoft's SMTP relay. It is distinct from Azure Authentication, which uses the Graph API. Because both methods use Entra applications, be sure to confirm which method you are implementing before configuring permissions.

Prerequisites

This method applies only when all of the following are true:

  • OAuth authentication is being used with SMTP (not the Graph API).
  • Mail is being sent through Microsoft's SMTP relay (smtp.office365.com).
  • SMTP AUTH is enabled in Exchange Online for the sending mailbox. SMTP AUTH is disabled by default in many Exchange Online environments and must be explicitly enabled.

Required Permissions

The Entra application must have the following permission: SMTP.Send.

📘

Note

Microsoft has deprecated the Outlook REST APIs; it is recommended to use the Graph API (Azure Authentication).

When you choose OAuth2 Authentication, set the following:

  • OAuth authentication email — The email for which the OAuth token was created
  • OAuth client ID — Azure Client ID
  • OAuth client secret — Azure Client secret
  • OAuth refresh token — The derived value of creating active tokens from Client ID and Secret ID - see instructions below.
  • OAuth URL — The URL to authenticate with and which generates the Access tokens, for example: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

To generate the Azure OAuth2 refresh token, follow these steps:

Generating the Azure OAuth2 refresh token for email settings

Prerequisites in Azure Portal

  1. Go to Azure Portal → Azure Active Directory → App registrations.
  2. Select your app (or create one if needed).
  3. Under API permissions, add:
    • https://outlook.office.com/IMAP.AccessAsUser.All
    • https://outlook.office.com/SMTP.Send
    • offline_access (this is what enables refresh tokens)
  4. Under Authentication, add a redirect URI (e.g., https://localhost works for manual flows).

Step 1 — Get an Authorization Code

  1. Open this URL in a browser, substituting your values:
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?client_id={client_id}&response_type=code&redirect_uri=https://localhost&response_mode=query&scope=https://outlook.office.com/IMAP.AccessAsUser.All%20https://outlook.office.com/SMTP.Send%20offline_access%20openid
  1. Sign in with the target email account. You'll be redirected to a URL like:
https://localhost/?code=0.AQAAB...&session_state=...
  1. Copy the code value from that URL.

Step 2 — Exchange the Code for Tokens

Run this curl command (or equivalent HTTP POST):

curl -X POST "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "client_id={client_id}" \
  -d "client_secret={client_secret}" \
  -d "code={authorization_code_from_step_1}" \
  -d "redirect_uri=https://localhost" \
  -d "grant_type=authorization_code"

Step 3 — Extract the Refresh Token

The JSON response will contain:

{
  "access_token": "...",
  "refresh_token": "0.AQAAB...",
  "expires_in": 3600,
  ...
}

Copy the refresh_token value and use it as the OAuth refresh token in your email settings.

Notes

  • The refresh token is long-lived but not permanent — it will expire if unused for 90 days (by default), or if the user revokes access.
  • The offline_access scope is required in step 1 or Azure will not return a refresh token at all.
  • Make sure the redirect URI in step 1 exactly matches what's registered in your Azure app.

General Email Configuration

  • Use SSL for connection — Configure the connection to be Unencrypted, Verified, or Unverified.
    • When you select the Verified or Unverified options, you can optionally provide the following files, depending on your SMTP server's configuration:
      • CA file — required only if your SMTP server uses a private or self-signed certificate authority not trusted by default. For standard servers such as Microsoft O365 (smtp.office365.com), this is not needed, as their certificates are signed by a publicly trusted CA.
      • Certificate file and Private key — required only if your SMTP server uses mutual TLS (mTLS), which requires the client to present its own certificate. Most standard email servers, including O365, do not require this.
    • When you select the Unencrypted option, the system attempts using TLS when sending emails (the default; no TLS configuration required). If TLS fails and the connection is active (if lost, the system first reestablishes the connection), the system proceeds to send emails without TLS.
  • Define the Sender address for all emails sent by Axonius. If empty, the sender address is [email protected].
  • Compress email attachments (default: false) — Select this option to compress email attachments. This affects email attachments sent from reports and those sent as part of the Send email Enforcement Set action.
    • When this feature is activated, email attachments are sent as one compressed attachment in zip format.
    • When this feature is not activated, all email attachments are not compressed, and are sent as separate files.
📘

Note

If attachments are larger than 10 Megabytes, the system notifies you that the email is 'big' (as some systems have a limitation on the size of emails that they can handle).


Did this page help you?