Configure your app in Microsoft Entra ID - Teams (2024)

  • Article

Microsoft Entra ID provides app users access to your bot or message extension app. The app user who has signed in to Teams can be given access to your app.

SSO configuration in Microsoft Entra admin center

The bot and message extension apps use Bot Framework for communicating with app users and implementing authentication.

To configure SSO for your bot or message extension app, you'll need to:

  • Configure bot resource in Microsoft Entra ID
  • Configure app in Microsoft Entra ID

Note

Ensure that you've created an app and a bot resource in Microsoft Entra ID.

  • For more information about creating an app in Microsoft Entra ID, see Register a new app in Microsoft Entra ID.
  • For more information about creating and configuring your bot resource in Microsoft Entra ID, see Create Teams conversation bot.

You can configure your bot resource and app in Microsoft Entra ID for your bot or message extension app in one of the following two ways:

  • Configure SSO using bot resource and configure Microsoft Entra app: You can start by configuring SSO for your bot resource, and enable SSO for your Microsoft Entra app. You'll configure:

    • For bot resource: Messaging endpoint and OAuth connection.

      Note

      When you create your bot resource in Microsoft Entra ID, you can select the option for creating a new app ID, or you can use an existing app ID if you've already registered your app in Microsoft Entra ID.

    • For Microsoft Entra app: App ID URI, scope and permissions, trusted client IDs, access token version, client secret, and redirect URL.

  • Configure SSO using Microsoft Entra app and then configuring bot resource: You can start by configuring your Microsoft Entra app, and then use this app ID in the bot resource when you enable SSO for it. You'll configure:

    • For Microsoft Entra app: App ID URI, access token, trusted client IDs, access token version, client secret, and redirect URL.

    • For bot resource: Messaging endpoint and OAuth connection.

      Note

      Configure bot resource using the app ID generated by Microsoft Entra ID when you registered your app.

Enable SSO in Microsoft Entra ID

By the end of this tutorial, you'll learn to configure:

  • Application ID
  • Bot ID
  • Access token
    • Application ID URI
    • Scope, permissions, and authorized client IDs
    • Client secret
    • Redirect URL
  • Messaging endpoint and OAuth connection

Select one of the following two ways to configure SSO for your bot resource:

  • Use bot resource and configure Microsoft Entra app
  • Use Microsoft Entra app and then configure bot resource

To enable SSO for your app in Microsoft Entra ID:

  • Configure messaging endpoint
  • Configure SSO for Microsoft Entra app:
    • Configure scope for the access token
    • Configure access token version
    • Create client secret
    • Configure redirect URL
  • Configure OAuth connection

Important

Ensure that when you create your bot resource, select the option to create a new app ID. You can also use an existing app ID, if you've already registered an app in Microsoft Entra admin center.

Configure messaging endpoint

Messaging endpoint is where messages are sent to your bot. It enables communication with your bot.

To configure messaging endpoint for your bot resource

  1. Open the Azure portal on your web browser.The Microsoft Azure Bot page opens.

  2. Enter the name of your bot resource in Search box, and select Enter to open it.

  3. Select Settings > Configuration.

    Configure your app in Microsoft Entra ID - Teams (1)

    The Configuration page appears.

  4. Enter the messaging endpoint URL where your bot receives app user's messages.

    Configure your app in Microsoft Entra ID - Teams (2)

  5. Select Apply.

    The messaging endpoint is configured.

You've configured the messaging endpoint for your bot resource. Next, you must enable SSO for the Microsoft Entra app.

Configure SSO for Microsoft Entra app

You must configure permissions and scopes, authorize client applications, update app manifest (previously called Teams app manifest), and create client secret for your Microsoft Entra app. These configurations help to invoke SSO for your bot app.

Configure scope for the access token

Configure scope (permission) options for sending access token to Teams client and authorizing trusted client applications to enable SSO.

You need:

  • To configure application ID URI: Configure scope (permission) options for your app. You'll expose a web API and configure the application ID URI.
  • To configure API scope: Define scope for the API, and the users who can consent for a scope. You can let only admins provide consent for higher-privileged permissions.
  • To configure authorized client application: Create authorized client IDs for applications that you want to pre-authorize. It allows the app user to access the app scopes (permissions) you've configured, without requiring any further consent. Pre-authorize only those client applications you trust, as your app users won't have the opportunity to decline consent.

To configure application ID URI

  1. Open the Azure portal on your web browser.

    The Microsoft Azure Bot page opens.

  2. Enter the name of your bot resource in Search box, and then select Enter to open it.

  3. Select Settings > Configuration.

    Configure your app in Microsoft Entra ID - Teams (3)

    The Configuration page appears.

  4. Select Manage.

    Configure your app in Microsoft Entra ID - Teams (4)

    The Microsoft Entra app page appears.

    The new app ID (client ID) for the app appears on this page. Note and save this app ID. You'll need to update it in the app manifest later. If you used the ID of an existing app when you created the bot resource, then ID of that app appears in this page.

    Configure your app in Microsoft Entra ID - Teams (5)

  5. Select Manage > Expose an API from the left pane.

    The Expose an API page appears.

  6. Select Add to generate application ID URI.

    Configure your app in Microsoft Entra ID - Teams (6)

    The section for setting application ID URI appears.

  7. Enter the application ID URI in the format explained here.

    Configure your app in Microsoft Entra ID - Teams (7)

    • The Application ID URI is prefilled with app ID (GUID) in the format api://{AppID}.

    Important

    • Sensitive information: The application ID URI is logged as part of the authentication process and must not contain sensitive information.

    • Standalone bot: If you're building a standalone bot, enter the application ID URI as api://botid-{YourBotId}. Here, {YourBotId} is your Microsoft Entra application ID.

    • Application ID URI for app with multiple capabilities: If you're building an app with a bot, a messaging extension, and a tab, enter the application ID URI as api://fully-qualified-domain-name.com/botid-{YourClientId}, where {YourClientId} is your bot app ID.

    • Format for domain name: Use lowercase letters for domain name. Don't use upper case.

      For example, to create an app service or web app with resource name, 'demoapplication':

      If base resource name used isURL will be...Format is supported on...
      demoapplicationhttps://demoapplication.example.netAll platforms.
      DemoApplicationhttps://DemoApplication.example.netDesktop, web, and iOS only. It isn't supported in Android.

      Use the lowercase option demoapplication as base resource name.

  8. Select Save.

    A message appears on the browser stating that the application ID URI was updated.

    Configure your app in Microsoft Entra ID - Teams (8)

    The application ID URI displays on the page.

    Configure your app in Microsoft Entra ID - Teams (9)

  9. Note and save the application ID URI. You'll need it for updating the app manifest later.

The application ID URI is configured. You can now define scope and permissions for your app.

To configure API scope

  1. Select + Add a scope in the Scopes defined by this API section.

    Configure your app in Microsoft Entra ID - Teams (10)

    The Add a scope page appears.

  2. Enter the details for configuring scope.

    Configure your app in Microsoft Entra ID - Teams (11)

    1. Enter the scope name.

    2. Select the user who can give consent for this scope. The default option is Admins only.

    3. Enter the Admin consent display name.

    4. Enter the description for admin consent.

    5. Enter the User consent display name.

    6. Enter the user consent description.

    7. Select the Enabled option for state.

    8. Select Add scope.

      Note

      For this tutorial, you can use openid profile User.Read User.ReadBasic.All as scope. This scope is suitable for using the Code sample. You can also add more Graph scopes and permissions. For more information, see Extend your app with Microsoft Graph permissions and scopes.

    A message appears on the browser stating that the scope was added.

    Configure your app in Microsoft Entra ID - Teams (12)

    Note

    The new scope you defined displays on the page. Ensure that you note and save the scope that you've configured. You'll need it to update OAuth connection later.

The scope and permissions are now configured. Next, you must configure the authorized client applications for your Microsoft Entra app.

To configure authorized client application

  1. Move through the Expose an API page to the Authorized client application section, and select + Add a client application.

    Configure your app in Microsoft Entra ID - Teams (13)

    The Add a client application page appears.

  2. Enter the appropriate Microsoft 365 client ID for the applications that you want to authorize for your app’s web application.

    Configure your app in Microsoft Entra ID - Teams (14)

    Note

    • The Microsoft 365 client IDs for mobile, desktop, and web applications for Teams, Microsoft 365 app, and Outlook are the actual IDs that you must add.
    • If your app has a tab app, you'll need either web or SPA, as you can't have a mobile or desktop client application in Teams.
  3. Select one of the following client IDs:

    Use client IDFor authorizing...
    1fec8e78-bce4-4aaf-ab1b-5451cc387264Teams mobile or desktop application
    5e3ce6c0-2b1f-4285-8d4b-75ee78787346Teams web application
    4765445b-32c6-49b0-83e6-1d93765276caMicrosoft 365 web application
    0ec893e0-5785-4de6-99da-4ed124e5296cMicrosoft 365 desktop application
    d3590ed6-52b3-4102-aeff-aad2292ab01cMicrosoft 365 mobile application Outlook desktop application
    bc59ab01-8403-45c6-8796-ac3ef710b3e3Outlook web application
    27922004-5251-4030-b22d-91ecd9a37ea4Outlook mobile application
  4. Select the application ID URI you created for your app in Authorized scopes to add the scope to the web API you exposed.

  5. Select Add application.

    A message appears on the browser stating that the authorized client app was added.

    Configure your app in Microsoft Entra ID - Teams (15)

    The authorized app's client ID displays on the page.

    Configure your app in Microsoft Entra ID - Teams (16)

    Note

    You can authorize more than one client application. Repeat the steps of this procedure for configuring another authorized client application.

You've successfully configured app scope, permissions, and client applications. Ensure that you note and save the application ID URI. Next, you configure the access token version.

Configure access token version

You must define the access token version for your app in the Microsoft Entra app manifest.

To define the access token version

  1. Select Manage > Manifest from the left pane.

    Configure your app in Microsoft Entra ID - Teams (17)

    The Microsoft Entra app manifest appears.

  2. Enter 2 as the value for the accessTokenAcceptedVersion property.

    Configure your app in Microsoft Entra ID - Teams (18)

  3. Select Save.

    A message appears on the browser stating that the app manifest was updated successfully.

    Configure your app in Microsoft Entra ID - Teams (19)

You've updated the access token version. Next, you'll create a client secret for your app.

Create client secret

A client secret is a string that the application uses to prove its identity when requesting a token.

To create a client secret for your app

  1. Select Manage > Certificates & secrets.

    Configure your app in Microsoft Entra ID - Teams (20)

    The Certificates & secrets page appears.

  2. Select + New client secret.

    Configure your app in Microsoft Entra ID - Teams (21)

    The Add a client secret page appears.

    Configure your app in Microsoft Entra ID - Teams (22)

    1. Enter the description.
    2. Select the duration of validity for the secret.
  3. Select Add.

    A message appears on the browser stating that the client secret was updated, and the client secret displays on the page.

    Configure your app in Microsoft Entra ID - Teams (23)

  4. Select the copy button next to the Value of client secret.

  5. Save the value that you copied. You'll need it later for updating code.

    Important

    Ensure that you copy the value of client secret right after you create it. The value is visible only at the time when the client secret is created, and it can't be viewed after that.

You've configured the client secret. Next, you must configure the redirect URL.

Configure redirect URL

Configuration for authentication depends on the platform or device where you want to target your app. You may need to configure redirect URIs, authentication settings, or platform-specific details.

Note

  • If your bot app hasn't been granted IT admin consent, app users have to provide consent the first time they use your app on a different platform.
  • Implicit grant is not required if SSO is enabled on a bot app.

You can configure authentication for multiple platforms as long as the URL is unique.

To configure redirect URL

  1. Open the app you registered in the Azure portal.

  2. Select Manage > Authentication from the left pane.

    Configure your app in Microsoft Entra ID - Teams (24)

    The Platform configurations page appears.

  3. Select + Add a platform.

    Configure your app in Microsoft Entra ID - Teams (25)

    The Configure platforms page appears.

  4. Select the platform that you want to configure for your app. You can select the platform type from Web or SPA.

    Configure your app in Microsoft Entra ID - Teams (26)

    The Configure Web page appears.

    Note

    The configurations will be different based on the platform you select.

  5. Enter the configuration details for the platform.

    Configure your app in Microsoft Entra ID - Teams (27)

    1. Enter the redirect URI. The URI should be unique.

      Note

      The URL mentioned in Redirect URIs is an example.

    2. Enter the front-channel logout URL.

    3. Select the tokens you want Microsoft Entra ID to send for your app.

  6. Select Configure.

    The platform is configured and displayed in the Platform configurations page.

The Microsoft Entra app configuration is complete, and now you must enable SSO support for your bot resource by configuring OAuth connection.

Configure OAuth connection

For a bot to support SSO, you must update its OAuth connection settings. This process associates the bot with app details that you configured for your Microsoft Entra app:

  • Microsoft Entra app ID, which is the client ID
  • Tenant ID
  • Scope and permissions

With the app (client) ID and client secret provided, the Bot Framework Token Store exchanges the token for a graph token with defined permissions.

To update OAuth connection

  1. Open the Azure portal on your web browser.The Microsoft Azure Bot page opens.

  2. Enter the name of your Microsoft Entra app in Search box, and open your app.

  3. Select Settings > Configuration.

    Configure your app in Microsoft Entra ID - Teams (28)

    The Configuration page appears.

  4. Move through the Configuration page and select Add OAuth Connection Settings.

    Configure your app in Microsoft Entra ID - Teams (29)

    The New Connection Setting page appears.

  5. Enter the OAuth configuration settings for the Azure bot.

    Configure your app in Microsoft Entra ID - Teams (30)

    1. Enter a name for the configuration setting.

    2. Select the service provider.

      The remaining configuration details appear.

      Configure your app in Microsoft Entra ID - Teams (31)

    3. Enter the app (client) ID for the Microsoft Entra app.

    4. Enter the client secret that you've created for your bot.

    5. Enter the application ID URI of your bot in the Token Exchange URL.

    6. Enter the tenant ID.

    7. Enter the scope that you defined when you configured the scope and permissions.

  6. Select Save.

  7. Select Apply.

    After you've configured the OAuth connection, you can select Test connection to check if the OAuth connection is successful.

    Configure your app in Microsoft Entra ID - Teams (32)

    If the connection isn't successful, Microsoft Entra ID displays an error. You can verify all the configurations and test again.

Congratulations! You've completed the following app configurations in Microsoft Entra ID required to enable SSO for your bot app:

  • Application ID
  • Bot ID
  • Access token
    • Application ID URI
    • Scope, permissions, and authorized client IDs
    • Client secret
    • Redirect URL
  • Messaging endpoint and OAuth connection

Best practices

  • Keep the Microsoft Entra app registration restricted to its original purpose of service to service application.
  • For better control over disabling authentication connections, rolling secrets, or reusing the Microsoft Entra app with other applications, create an additional Microsoft Entra app for any user to service authentication.

If you use the Microsoft Entra registration app for authentication, you might encounter the following issues:

  • If you renew the certificate attached to the Microsoft Entra app registration, it affects the users who have authenticated with other Microsoft Entra services using the certificate.
  • It creates a single point of failure and control for all authentication-related activities with the bot.

Next step

Add code to enable SSO

Feedback

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.

Submit and view feedback for

This product This page

Configure your app in Microsoft Entra ID - Teams (2024)
Top Articles
Latest Posts
Article information

Author: Carmelo Roob

Last Updated:

Views: 5774

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Carmelo Roob

Birthday: 1995-01-09

Address: Apt. 915 481 Sipes Cliff, New Gonzalobury, CO 80176

Phone: +6773780339780

Job: Sales Executive

Hobby: Gaming, Jogging, Rugby, Video gaming, Handball, Ice skating, Web surfing

Introduction: My name is Carmelo Roob, I am a modern, handsome, delightful, comfortable, attractive, vast, good person who loves writing and wants to share my knowledge and understanding with you.