Email This Issue
📈 Marketplace❓ Support❤️ Feedback🏠 META-INF Apps
Email This Issue - for Jira Server/Data Center
Email This Issue - for Jira Server/Data Center
  • ⬇️Start Here
  • Email This Issue - for Jira Server/DC
  • Features
  • Secure the email channel with Email This Issue
  • Comparing Email This Issue and Jira Server/DC
  • 🤓Documentation
    • Outgoing Emails
      • Sending manual emails
        • The difference between email editors
        • Enabling template categories so templates can be chosen on the Email screen
        • Mail Generation Queue (formerly called Event Queue)
        • Manual Email Default Settings
      • Sending issue filters by email
      • Email templates
        • Adding custom macro to email templates
        • Adding Email Audit Log to email templates
        • Adding fields to email templates
        • Adding issue comments to emails
        • Adding issue link information to your template
        • Adding issue operation links to the email
        • Adding a signature with a company logo to emails
        • Adding user properties to emails
        • Disabling links and avatars or icons in templates
        • Formatting Date and Time values
        • Using reply templates
        • Using Mail Body Initializer templates
        • Rendering templates within templates
        • Velocity Context in email templates
        • Formatting number values
        • Searching for issues in email templates
        • Changelog information in email templates
        • Canned responses
      • Contexts
        • Context Resolution Algorithm
      • Event Notifications
      • Distribution lists
      • Workflow post functions
      • Custom fields
    • Incoming Emails
      • Attachment Filtering
      • Next Generation Mail Handlers
        • Jira automation and Next Generation Mail Handlers
        • Using regular expressions
      • Classic Mail Handlers - Deprecated
        • Mail Handler Error Log
        • Step-by-step Classic Mail Handler to Next Generation Mail Handler migration aid
        • Field Rules
        • Phasing out the Classic Mail Handler
        • Comparing the Classic and the Next Generation Mail Handlers
    • Integrations
      • CRM for Jira
      • nFeed
      • Glass Documentation
      • API - Integration with other services
    • Administration
      • General configuration
      • Email Audit Log
      • Outgoing Mail Connections
      • Outgoing Mail Queue
      • Incoming Mail Connections
      • Incoming Mail Queue
      • Incoming Mail Log
      • Backup and restore settings
        • Backup and restore administration
          • Backup menu
          • Restore menu
        • Backup and Restore Tutorials
          • Backup and restore for empty email settings
          • Backup and restore only parts of a configuration
          • Backup and restore every setting in the same instance
      • OAuth2 Authorizations in Email This Issue
        • OAuth2 Client Credentials
        • Authorizing Email This Issue to access Gmail accounts
        • Authorizing Email This Issue to access Microsoft 365 accounts
        • Enabling OAuth2 Authorization in your Google Account
        • Enabling OAuth2 authorization in your Microsoft 365 account
        • Troubleshooting guides for Microsoft OAuth2 Connections
          • How to fix "Authorization Was Interrupted" error
          • How to fix "BAD User is authenticated but not connected" error
          • How to fix "401 Unauthorized" error
          • How to fix "key expires_in " error
          • How to fix "Need admin approval" error
      • Alerting via Webhooks
        • Webhooks
          • Configuring Slack to receive webhooks
          • Configuring OpsGenie to receive webhooks
        • Webhook execution logs
      • Email Security
    • Service management integration
    • JQL Functions
    • Top-level menu navigation
  • ☁️Server to Cloud Migration
    • Server to Cloud - Automatic Migration tool
    • Server to Cloud - Manual migration guide for Email This Issue
      • Overview of available features
      • Differences of the Server and Cloud user interface
      • Migrating Outgoing Settings
        • Migrating Templates
        • Migrating Notifications
        • Migrating Manual Email Defaults
        • Migrating Contexts
        • Migrating Canned Responses
        • Migrating Post Functions
        • Migrating Outgoing Mail Connections
      • Migrating Incoming Settings
        • Migrating Classic Mail Handlers
        • Migrating Next Generation Mail Handlers
        • Migrating Incoming Mail Connections
        • Migrating Incoming Mail Queue Settings
        • Migrating Incoming Mail Log Settings
      • Migrating Other Settings
        • Migrating OAuth2 Credentials
        • Migrating global default email settings
        • Migrating permissions for sending emails manually
        • Migrating recipient restrictions
  • ❓FAQ
    • FAQ
      • How to bypass workflow conditions
      • How to avoid email loops
      • How to control who to send emails to
      • How to customize Email From in outgoing emails
      • How to enable logging
      • How to install license keys
      • How to find out why the Email button is missing
      • How to obtain a community or non-profit license
      • How to prevent duplicate emails
      • How to remove old content from reply emails
      • How to send personalized emails to recipients
      • How to set up auto-reply or acknowledgment emails
      • How to track cases when you don't get any emails
      • How to view the log of incoming and outgoing emails
      • The iOS Mail app does not show attachments
      • How to route emails to projects
      • How to maintain email threads in Jira
      • How to fix issues with a corrupt index state
      • How to set polling interval for mail accounts manually
    • Tutorials
      • Configuring email approval
      • Customizing the email template used with manual emails
      • Enhance Jira Service Management with Email This Issue
      • Getting Started
      • Setting up an Email Help Desk
      • Setting up customized notifications
      • Setting up a Service Management with a Next-Gen Mail Handler
  • 🌪️Misc
    • Open Source Components
    • Pricing Updates
      • Pricing Update effective October 1st 2018
      • Pricing Update effective December 1, 2021
    • End of Support Policy
    • Security Advisories
      • Email This Issue Security Advisory 2020-02-18
    • Database Tables
    • Translations
  • 🆕Release Notes
    • Release notes
      • 9.x.x
        • 9.15.0 Jira 10 compatibility
        • 9.13.0 Improvements and Fixes
        • 9.11.0 Improvements and fixes
        • 9.10.0 Major improvements and fixes
        • 9.9.1 Improvements and fixes
        • 9.9.0.2 Major improvements and fixes
        • 9.8.0 Improvements and fixes
        • 9.7.0 Improvements and fixes
        • 9.6.0 Improvements and fixes
        • 9.5.0 Improvements and fixes
        • 9.4.0 Bugfixes
        • 9.3.3. Improvements and fixes
        • 9.3.2 Major improvements
        • 9.3.1 Automatic cloud migration
        • 9.2.2.1 Bugfixes
        • 9.2.2 Improvements and fixes
        • 9.2.1.3 Compatibility changes for Jira 9.0.0
        • 9.2.1 Major improvements
        • 9.2.0 Improvements and fixes
        • 9.1.1 Improvements and fixes
        • 9.1.0.1 Alerting and other major new features
        • 9.0.2 Bugfixes, next step in deprecating the Classic Mail Handler
        • 9.0.1 Minor improvement and fixes
        • 9.0.0 Major improvements
        • 9.12.0 Improvement and fixes
        • 9.17 Improvements and Fixes
        • 9.18.0 Improvements and fixes
      • 8.1.x
        • 8.1.3 Classic handler is deprecated, timezone support, bug fixes
        • 8.1.2 Important bug fixes
        • 8.1.1 Microsoft 365 OAuth2, improvements and fixes
        • 8.1.0 Microsoft 365 OAuth2, improvements and fixes
      • Up to 8.0.6
Powered by GitBook
On this page
  • Introduction, checking your account details and subscription
  • Registering an application
  • Step 1 - Finding Azure Active Directory to manage your account
  • Step 2 - Initiating an app registration
  • Step 3 - Account (tenant) type selection
  • Step 4 - Define API permissions
  • Step 5 - Generating a client secret
  • Step 6 - Copying endpoints URIs
  • Removing consent

Was this helpful?

  1. Documentation
  2. Administration
  3. OAuth2 Authorizations in Email This Issue

Enabling OAuth2 authorization in your Microsoft 365 account

PreviousEnabling OAuth2 Authorization in your Google AccountNextTroubleshooting guides for Microsoft OAuth2 Connections

Last updated 6 months ago

Was this helpful?

On this page

Introduction, checking your account details and subscription

This article explains how to enable Microsoft 365 OAuth2 in your Microsoft Azure tenant to authenticate Email This Issue. This allows you to send FROM and receive TO your Microsoft 365 address using this application.

This guide applies to create and configure client credentials for both incoming and outgoing connections requiring the following OAuth2 authentication:

  • IMAP with OAuth2 authentication to read an Office365 mailbox

  • SMTP with OAuth2 authentication to send mails from Office365 address

  • Microsoft Graph API (uses OAuth2 by default) to read an Office365 mailbox

  • Microsoft Graph API (uses OAuth2 by default) to send mails from Office365 address

The only difference between these use cases is in their permission scopes they require to operate, i.e. all the steps detailed in the Application registration chapter are basically identical.

Before you begin with the app registration, check if you have the following:

  • A Microsoft365 account

  • An active (aka “subscription”). Otherwise, you will get obscure error messages during the authorization process.

For example, if you have a Microsoft 365 Business Standard package, you should see something like this:

Registering an application

Step 1 - Finding Azure Active Directory to manage your account

Step 2 - Initiating an app registration

Click on + New registration

Step 3 - Account (tenant) type selection

Register your application as illustrated:

Make sure to add the following content to the fields:

  • Name: An easily identifiable name.

  • Account type: Select the account type whether it should be available for accounts outside your organization or not.

    • Single tenant: choose this if the app is accessible for your organizational directory

    • Multitenant: choose this if you want to allow any organizations to use this app

  • Redirect URI: In the Redirect URI section, do the following:

    • Leave the Web as selected.

Important: As of now the OAuth2 for SMTP/IMAP is not supported for personal Microsoft accounts.

Step 4 - Define API permissions

API Permissions (scopes) need to be granted for the application.

1. Click on the Register button to create your application

2. On the overview page of your newly created app select the API permissions / Security -> Permission menu:

3. To achieve this list of permission for your app do the following:

3.1. Do not remove the User.Read permission added as a default by the portal, as this is required to automatically obtain the username (more specifically, the userPrincipalName) associated with the account (identified by the email address you'll provide during the mail connection setup in the Email This Issue app).

3.2. To add any further permissions (scopes), click on the Add a permission button and select the Microsoft Graph group:

3.3. Select Delegated permissions then find and select the permissions. Depending on your actual use case (i.e. the used messaging/communication protocol), the following permissions shall be added:

  • General permissions (required both for incoming and outgoing connections)

General permissions are needed to acquire a refresh token and then manage access tokens (i.e. these are required in each and every use case). Besides offline_access and openid, the User.Read permission is also necessary. If not added by default (-> see point 3.1.), please manually add it now.

  • IMAP permissions (required for inbound traffic)

Permissions to use the IMAP protocol. In the filtering field provide the search term imap:

  • SMTP permissions (required for outbound traffic)

Permissions to use the SMTP protocol. You can find the permission for SMTP by entering smtp in the search field:

  • Graph API permissions to fetch messages

Permissions to use Graph API for incoming connections. These permissions can be found by entering mail. in the search field:

  • Graph API permissions to send messages

Permissions to use Graph API for outgoing connections. These permissions can be found by entering mail. in the search field:

General notes: The selections are retained between filtering. As soon as all the permissions have been selected, they can be added together by clicking on the Add permissions button at the bottom. This enables mixing and mingling any permission scopes within an app registration and exposing them via a client secret.

This also means that if using separate mailboxes (email addresses) is needed for different tasks, it is necessary to configure and grant the permissions for that functionality only. For example, it is possible to differentiate between incoming and outgoing connections, i.e. an app registration (and a respective client credential) can be created to configure a Mail Handler, while another registration can be made to use for message sending only (i.e. in order to configure a mailbox to be used by an incoming connection, permissions related to the SMTP protocol are unnecessary). In other words, the concept of mail providers allows for granular use and definition of permission scopes and the respective client credentials representing them.

In the Microsoft365 world, within a tenant, several app registrations can exist (with diverging configurations) for the very same account (mail address), while different accounts (mail addresses) might be used within a tenant to implement different tasks with individual app registrations for each, as well. There is also the possibility of creating a multi-tenant app registration if there is a demand for accessing a mailbox from different tenants (i.e. organizations/companies/departments/etc.) or from external addresses. Access and permission schemes can be organized according to your needs.

Step 5 - Generating a client secret

1. Select the Certificates & secrets menu.

2. Click on the New client secret button to create a new client secret.

3. Add a description.

4. Select the expiration date that fits your needs

5. Click Add.

Important: Don’t forget to copy the client secret and provide it to the configuration part along with the Client ID from the Overview page of the app.

Step 6 - Copying endpoints URIs

The authorization and token endpoints need to be added from the Microsoft app to the Client Credentials in Email This Issue.

Note: Without doing this you need to pay attention to finding and applying these endpoint URIs.

In the case of Microsoft 365 Oauth2, the authorization and token endpoints are different for multi- and single-tenant configurations.

For both the multi and single tenant configuration you find this information on the Overview page of the registered application selecting the Endpoint menu on the top as it is shown on the following screenshots. Copy and paste both of them.

You can easily copy and paste both of them.

Removing consent

The released access token still will be valid within its validity period. Only by refreshing the access token will it fail for this specific account. The application registration is untouched and other accounts can continue to use it.

Visit the following link in your Microsoft Azure account (within your Azure Active Directory):

Copy and paste the Callback URL from the dialog as the URI value. As this URL is specific to your Jira instance, it is important to copy the URL from the Email This Issue app into this page as a URI of another Jira instance cannot be reused.

Generate a client secret to be used in .

For a single-tenant configuration, endpoints are unique for each tenant. As a consequence, you must provide them on the dialog.

In case you want to revoke the permission from the registered application to authenticate on behalf you just visit and delete the registered application from the list as shpwn in the following image:

🤓
https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps
OAuth2 Client Credentials
client credentials
OAuth2 Client Credentials
https://myapps.microsoft.com/
Introduction, checking your account details and subscription
Registering an application
Step 1 - Find Azure Active Directory to Manage You Account
Step 2 - Initiating an app registration
Step 3 - Account (tenant) type selection
Step 4 - Define API permissions
Step 5 - Generate client secret
Step 6 - Copy endpoints URIs
Removing consent
Exchange Online license
Double-checking the Microsoft 365 subscription
Initiating a new app registration on the Azure Portal
Registering an application
The complete list of permissions required for both incoming and outgoing connections
Encountering and keeping the User.Read permission associated with the app registration by default
Navigating to the API permission manager
General permissions
IMAP-specific permissions
SMTP-specific permissions
Graph specific permissions for receiving emails
Graph specific permissions for sending emails
Azure Active Directory: Certificates & secrets
Adding a new client secret
Info panel calling for copying the client secret
The location of Client ID (aka Application ID) to copy from
Copying endpoint URIs
Withdrawing personal consent (granted for an app previously)