Body
This article covers the process for configuring TeamDynamix Email Replies and ticketing Email Monitors.
TeamDynamix Configuration Steps
In order to read email from an email account, you must define an Email Auth Account that contains the credentials and location of the email address.
To configure an Email Auth Account, follow these steps:
- Navigate to the appropriate Email Auth Accounts page. For email replies, auth accounts can be configured at the organizational level or in any platform application. For email monitors, auth accounts are configured in the ticketing application. Email Auth Accounts are configured in the following places:
- Organization-level email replies: TDAdmin > Email > Email Reply Auth Accounts
- Ticketing Applications: TDAdmin > Applications > [Ticketing Application] > Email > Email Auth Accounts
- Asset/CI Applications: TDAdmin > Applications > [Asset/CI Application] > Email > Email Reply Auth Accounts
- Client Portal Applications: TDAdmin > Applications > [Client Portal Application] > Email > Email Reply Auth Accounts
- Click New.
- Enter a Name and optional Description for the auth account.
- Choose the Account Type. This determines how the email service will try to authenticate. See the sections below for details about each authentication type. The following types are available:
- Basic (IMAP) (Deprecated for Microsoft 365 on 10/1/2022)
- Gmail OAuth 2.0 (IMAP)
- Microsoft OAuth 2.0 (IMAP)
- Google OAuth 2.0
- Microsoft OAuth 2.0
- Mark the auth account active and Save.
Basic (IMAP)
IMAP basic authentication is the simplest type of email account to set up. All email monitors and email reply monitors created before version 11.1 use IMAP basic authentication, and are automatically converted to use an IMAP basic authentication email auth account. To configure an IMAP connection, you will need to provide the following information:
- Username
- Password
- Server Name
- Server Port
If you are not using G Suite or Microsoft 365 for your email, you will need to use Basic (IMAP) for your auth accounts.
G Cloud
The Gmail OAuth 2.0 (IMAP) and Google OAuth 2.0 email account types both use G Suite's OAuth flow to get a token for the email account. The Gmail OAuth 2.0 (IMAP) account type will get a token and use it to make IMAP calls, and the Google OAuth 2.0 account type will get a token and use it to call Google's email APIs.
Google currently supports IMAP using basic authentication and OAuth, as well as supporting using their APIs to read email. They have announced plans to remove support for basic authentication with IMAP and they prefer using the email APIs. Therefore, if you use G Suite for email, TeamDynamix recommends not using Basic IMAP authentication accounts.
To configure Gmail OAuth, you will need to provide the following information:
- Client ID
- Client Secret
Once you have entered these values, click Generate Tokens to automatically generate an access token and refresh token.
NOTE: To ensure that mailboxes can be accessed, you will need to generate the tokens by logging in with a user who has access to any email addresses you wish to monitor. You may not get prompted to log in if you are already logged into Google with an account. Be sure that it is the correct account to generate the token without an error.
Follow these steps in the Gmail account to generate a Client ID and Client Secret:
- Navigate to https://console.developers.google.com/ and log in as the account you want to grant access to.
- Select an existing Project or create a new project using the New Project button.
- Click on the OAuth Consent Screen navigation item from the API & Services menu.
- Select User Type of External > Create
- Provide the required content in the User Type at the top, then additional details listed below in Step 6.
- Add the domain for your TeamDynamix environment in the Authorized Domains field without any subdomains or paths (e.g. teamdynamix.com).
- Click on the Credentials navigation item.
- Click Create Credentials > OAuth Client ID.
- Choose the "Web Application" application type.
- Enter your base URL for TeamDynamix in the Authorized JavaScript origins field. This includes the subdomain, such as https://example.teamdynamix.com.
- Enter the base URL for TeamDynamix plus "/TDAdmin/OAuth/Callback" in the Authorized Redirect URIs field. For example, https://yourTeamDynamixDomain/TDAdmin/OAuth/Callback.
- Click Create. The Client ID and Client Secret will display.
If you are setting this up for a Google OAuth 2.0 account, there is one additional step that will be needed for the email account to work. Select the project from step 2, and in the Dashboard tab click on the + Explore and Enable API button. In the explorer, search for "Gmail API." Once you have located it, select the API, and click the Enable button.
Microsoft 365
The Microsoft OAuth 2.0 (IMAP) and Microsoft OAuth 2.0 email account type uses Microsoft's OAuth flow to get a token for the email account to read email. The Microsoft OAuth 2.0 (IMAP) account type will get a token and use it to make IMAP calls, and the Microsoft OAuth 2.0 account type will get a token and use it to call Microsoft's email APIs.
As of 10/1/2022, Microsoft will no longer support IMAP using Basic Authentication. We would recommend using Email Authentication Accounts of type Microsoft OAuth 2.0.
To configure Microsoft OAuth, you will need to provide the following information:
- Client ID
- Client (Secret) Value
Once you have entered these values, click Generate Tokens to automatically generate an access token and refresh token. If successful authentication displays a message that only administrators can grant application permissions, see the User Consent Settings section for additional configuration steps.
NOTE: To ensure that mailboxes can be accessed, you will need to generate the tokens by logging in with a user who has access to any email addresses you wish to monitor. It is highly recommend to generate the token using the email address of the actual account
to-be-monitored (ex. replies@domain.com) rather than using an account that simply has access to that email account.
If there is an active Microsoft login in the browser, it may be automatically used for token generation with no displayed dialog. You may need to generate the tokens from a private browser window to ensure the correct Microsoft account gets used for token generation. Further, if you use SSO for TDX authentication, you'll want to bypass SSO to login to TDX for token generation.
https://EXAMPLENAME.teamdynamix.com/TDAdmin/LoginTDAuth.aspx
Note: while setting up the Email Replies monitor and you receive this error at Save, you will need to ensure you reference the information above to log in bypassing SSO and generate tokens with the email account that the Replies monitor is associated with.
AZURE CLIENT SECRET 2-YEAR EXPIRATION: Microsoft has limited client secret to a 2-year maximum expiration. You can read more here:
Microsoft Notification
It is advised to consider a schedule ticket in your TDX system to ensure this is refreshed appropriately.
The following steps are the high level items related to creating an OAuth based auth account for TDX email tools. If you want a more in depth view into these steps, please download the white paper attached to this article.
Follow these steps in the Microsoft account to generate a Client ID and Client Secret:
- Navigate to https://portal.azure.com/ and log in with the service account associated with your Azure subscription.
- Locate the Azure Active Directory service by clicking on the list of "All Services" and searching for it.
- Under the "Manage" section, click on the App Registrations navigation item.
- Click on the + New Registration button and configure the application:
- Provide the user-facing Name and the Supported Account Types for the application, with the latter controlling permissions for who can consume the application.
- Redirect URI - Select Web in the dropdown and enter your base URL, including the subdomain, with the OAuth callback endpoint specified (e.g. https://yourTeamDynamixDomain/TDAdmin/OAuth/Callback) (This is a case sensitive URI)
- Click the Register button to create the application
- Under the "Manage" section, click on the Certificates & secrets navigation item and select the + New client secret button, selecting the 2-year option for the expiration.
- If your organization cannot set the duration to Never, set it to 24 months.
- Copy the secret value (the middle column's value, not the Secret ID on the right), because navigating away from the page at this point hides it forever, and Microsoft does not offer a copy option once it's hidden.
- Under the "Manage" section, click on the API permissions navigation item and add the required permission:
- Click the + Add a permission button
- Select Microsoft Graph in the dialog displayed on the right side of the page
- Select Delegated permissions from the next screen
- Select the following permissions:
- IMAP.AccessAsUser.All (required for Microsoft OAuth 2.0 (IMAP) only)
- Mail.ReadWrite.Shared (required for Microsoft OAuth 2.0 only)
- User.Read (required for Microsoft OAuth 2.0 only)
- Click Add permissions
User Consent Settings
For proper connectivity to the mailbox, the app registration needs certain permissions granted as outlined in the previous section. However, these permissions are only granted when a user authenticates to generate the access/refresh tokens. Further, there is a configuration setting in Azure which determines what users are able to grant permissions to app registrations. This setting can be viewed in your Azure subscription by locating the Enterprise applications service and clicking on the Consent and permissions navigation item. If Allow user consent for apps is selected, then you should not need to take any additional action for the auth account to properly work. If Allow user consent for apps from verified publishers, for selected permissions is selected, non-administrators can generate tokens if all permissions granted in step 6.4 are classified as low impact on the Permission classifications page.
Otherwise, you will need Azure administrator assistance to generate OAuth tokens for the app registration. After the permissions have been added to the application in step 6.4, you will need to explicitly click the Grant admin consent button on this page. Once each permission displays as "Granted" in the Status column, non-administrators will be able to generate tokens for the application.
Shared Mailboxes
TeamDynamix can read mail from a Microsoft 365 shared mailbox using either the Microsoft OAuth 2.0 authentication account type or the Microsoft OAuth 2.0 (IMAP) authentication account type. Microsoft OAuth 2.0 authentication accounts will only support shared mailboxes if the authentication account was created in TeamDynamix after version 11.6 was released. To properly set up a shared mailbox, the person configuring the authentication account in TDX needs to have send-as and full delegate access to the shared mailbox, and appropriate User Consent Settings, as described above.