Segura® Platform authenticates Microsoft-hosted SMTP and IMAP mail accounts with OAuth2.0 through a native Authenticate flow. This flow replaces the email-oauth2-proxy component for Microsoft accounts and works in multi-tenant environments.
This document covers the Azure setup, the credential, and the SMTP account. The Azure application and credential you create here also authenticate IMAP. To configure the IMAP account itself, see Manage IMAP/POP3 settings.
The native flow applies to Microsoft-hosted mail accounts only, identified by host: office365.com, outlook.com, outlook.office365.com, smtp.office365.com, smtp-mail.outlook.com, imap-mail.outlook.com, pop-mail.outlook.com, live.com, hotmail.com, and onmicrosoft.com. For any other provider, use the email-oauth2-proxy method: see Register the email-oauth2-proxy component.
Requirements
- Administrative access to the Microsoft Azure Portal, including rights to grant the requested permissions.
- Administrative access to Segura® Platform.
- The Segura® Platform URL, to register as the Azure redirect URI.
Register an application in Azure
- Access the Azure Portal and log in to your Azure account.
- Locate the service Microsoft Entra ID.
- In the left menu, select Manage > App registrations.
- Select your existing mail application, or select New registration to create one.
- In the application's left menu, select Manage > Authentication.
- Under Web > Redirect URIs, add or update the URI so that it ends with
flow/mail/auth/return. Use the following format, and match it exactly, including the scheme:
https://<your-segura-url>/flow/mail/auth/return
- From the application's Overview page, copy the Application (client) ID and the Directory (tenant) ID. You need both values later.
Generate a client secret
- In the application's left menu, select Manage > Certificates & secrets.
- Select New client secret.
- In the Description field, enter a description for the client secret.
- In the Expires field, select when the client secret expires.
- Select Add.
Copy the Value field of the client secret immediately. Azure hides this value after you leave the page, and you cannot retrieve it later.
Configure API permissions
- In the application's left menu, select Manage > API permissions.
- Select Add a permission, then select Microsoft Graph.
- Select Delegated permissions.
- Add the following permissions:
- Mail.Send: supports sending through SMTP.
- Mail.Read, labeled Read user mail: supports reading through IMAP.
- Select Add permissions.
Azure lists several read permissions with similar names. Select the one labeled Read user mail. A user grants consent to these permissions during the Authenticate step, when they log in to Microsoft.
Create a credential in PAM Core
- On Segura®, in the navigation bar, hover over the Products menu and select PAM Core.
- Go to Credentials > All credentials, and select Add.
- On the Information tab, complete the following fields:
- Username: enter the Application (client) ID you copied earlier.
- Device: enter the mail provider's host, for example
outlook.office365.comfor a Microsoft 365 account, oroutlook.live.comfor a personal Microsoft account. - Password type: select Local user.
- Additional information: enter the Directory (tenant) ID you copied earlier.
- Password: enter the client secret value you copied earlier.
- Select Save.
If the mailbox is a personal Microsoft account, Segura® Platform always uses the tenant value common, regardless of the Directory (tenant) ID stored in this credential.
Configure the SMTP account
- On Segura®, in the navigation bar, hover over the Products menu and select Settings.
- On the side menu, select Email > SMTP configuration. For the general account fields not covered here, such as account name, sender email, and reply email, see Manage SMTP settings.
- Add a new account, or edit an existing one, for the Microsoft mailbox.
- Complete the following fields:
- Host SMTP: enter the provider's host, for example
smtp.office365.com. - Port: enter
587. - Use safe connection?: select No.
- Ignore certificate error: select Yes.
- Enable footnote: select No.
- Host SMTP: enter the provider's host, for example
- In the Use authentication? field, select Yes.
- In the Credential for authentication field, select the credential you created in Create a credential in PAM Core.
- Select Send.
Authenticate with Microsoft
- In the accounts list, select the Actions button for the account, then select Authenticate.
- Segura® Platform displays a message: it will redirect you to Microsoft for authentication, and you will need to log in to Segura® Platform again afterward. Select Yes to continue.
- Log in to the Microsoft account associated with the mailbox.
- On the permissions screen, accept the requested access.
- Segura® Platform displays Success - Authenticated successfully.
- Select Back to login.
- Log in to Segura® Platform again to continue.
- In the accounts list, select the Actions button for the authenticated account, then select Test setting.
- Enter a destination address and send a test message.