Configure SMTP Outbound with OAuth using client credentials grant in Azure

Follow these steps to configure SMTP OAuth permissions for Azure to use Client Credentials grant.

  1. Log in to Azure portal.
  2. Navigate to Azure portal home page.
  3. Click API permissions on the left pane.

    The API permissions page is displayed.

  4. Click Add a permission.
  5. Click the APIs my organization uses tab.
  6. Select Office 365 Exchange Online. You can also use the search option to search and select the required API.
  7. Click Application permissions.
  8. Select SMTP > SMTP.SendAsApp .
  9. Click Add permissions.

    SMTP.SendAsApp is listed under a new group Office 365 Exchange Online under Application permissions.

  10. Click Grant admin consent for Kofax.
  11. Click Yes.

    The API permission SMTP.SendAsApp is granted.

Register service principals in Exchange Online

Follow these steps to register service principals in Exchange Online and provide access to the SMTP Outbound mailbox.

Run the following commands as an administrator in Windows PowerShell.

  1. Install-Module -Name ExchangeOnlineManagement
  2. Import-module ExchangeOnlineManagement
  3. Connect-ExchangeOnline -Organization <TENANT_ID>

    Make sure you log into Exchange Online with global administrator credentials of your tenant. Otherwise, step 4 and 5 would fail.

  4. New-ServicePrincipal -AppId <CLIENT_ID> -ObjectId <OBJECT_ID>
  5. Add-MailboxPermission -Identity <SMPT_OUTBOUND_USER_EMAIL_ADDRESS> -User <OBJECT_ID> -AccessRights FullAccess
  • CLIENT_ID = Azure client/application ID.
  • Do the following to get OBJECT_ID:

    • Go to Azure Portal home page.
    • On the right pane, click Managed application in local directory .

      The OBJECT_ID is displayed.