Configure IMAP/ POP3 with OAuth using client credentials grant in Azure

Follow these steps to configure IMAP/ POP3 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 IMAP > IMAP.AccessAsApp.
  9. Select POP > POP.AccessAsApp.
  10. Click Add permissions.

    IMAP.AccessAsApp and POP.AccessAsApp are listed under a new group Office 365 Exchange Online under Application permissions.

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

    The API permissions IMAP.AccessAsApp and POP.AccessAsApp are 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.