Single-tenant and multitenant authentication for Microsoft 365 users

This article gives you insight into the authentication process for single-tenant and multitenant, Microsoft Entra ID (Microsoft Entra ID) applications. You can use authentication when you build calling experiences for Microsoft 365 users with the Calling software development kit (SDK) that Azure Communication Services makes available. Use cases in this article also break down individual authentication artifacts.

Case 1: Example of a single-tenant application

The Fabrikam company has built an application for internal use. All users of the application have Microsoft Entra ID. Access to Azure Communication Services is controlled by Azure role-based access control (Azure RBAC).

A diagram that outlines the authentication process for Fabrikam's calling application for Microsoft 365 users and its Azure Communication Services resource.

The following sequence diagram details single-tenant authentication.

A sequence diagram that details authentication of Fabrikam's Microsoft 365 users. The client application gets an Azure Communication Services access token for a single tenant Microsoft Entra application.

Before we begin:

  • Alice or her Microsoft Entra administrator needs to give the custom Teams application consent, prior to the first attempt to sign in. Learn more about consent.
  • The Azure Communication Services resource admin needs to grant Alice permission to perform her role. Learn more about Azure RBAC role assignment.

Steps:

  1. Authenticate Alice using Microsoft Entra ID: Alice is authenticated using a standard OAuth flow with Microsoft Authentication Library (MSAL). If authentication is successful, the client application receives a Microsoft Entra access token, with a value of A1 and an Object ID of a Microsoft Entra user with a value of A2. Tokens are outlined later in this article. Authentication from the developer perspective is explored in this quickstart.
  2. Get an access token for Alice: The Fabrikam application by using a custom authentication artifact with value B performs authorization logic to decide whether Alice has permission to exchange the Microsoft Entra access token for an Azure Communication Services access token. After successful authorization, the Fabrikam application performs control plane logic, using artifacts A1, A2, and A3. Azure Communication Services access token D is generated for Alice within the Fabrikam application. This access token can be used for data plane actions in Azure Communication Services, like Calling. The A2 and A3 artifacts are passed along with the artifact A1 for validation. The validation assures that the Microsoft Entra Token was issued to the expected user. The application prevents attackers from using the Microsoft Entra access tokens issued to other applications or other users. For more information on how to get A artifacts, see Receive the Microsoft Entra user token and object ID via the MSAL library and Get an Application ID.
  3. Call Bob: Alice makes a call to Microsoft 365 user Bob, with Fabrikam's app. The call takes place via the Calling SDK with an Azure Communication Services access token. Learn more about developing application for Microsoft 365 users.

Artifacts:

  • Artifact A1
    • Type: Microsoft Entra access token
    • Audience: Azure Communication Services, control plane
    • Source: Fabrikam's Microsoft Entra tenant
    • Permissions: https://auth.msft.communication.azure.com/Teams.ManageCalls, https://auth.msft.communication.azure.com/Teams.ManageChats
  • Artifact A2
    • Type: Object ID of a Microsoft Entra user
    • Source: Fabrikam's Microsoft Entra tenant
    • Authority: https://login.microsoftonline.com/<tenant>/
  • Artifact A3
    • Type: Microsoft Entra application ID
    • Source: Fabrikam's Microsoft Entra tenant
  • Artifact B
    • Type: Custom Fabrikam authorization artifact (issued either by Microsoft Entra ID or a different authorization service)
  • Artifact C
  • Artifact D
    • Type: Azure Communication Services access token
    • Audience: Azure Communication Services, data plane
    • Azure Communication Services Resource ID: Fabrikam's Azure Communication Services Resource ID

Case 2: Example of a multitenant application

The Contoso company has built an application for external customers. This application uses custom authentication within Contoso's own infrastructure. Contoso uses a connection string to retrieve tokens from Fabrikam's application.

A sequence diagram that demonstrates how the Contoso application authenticates Fabrikam users with Contoso's own Azure Communication Services resource.

The following sequence diagram details multitenant authentication.

A sequence diagram that details authentication of Microsoft 365 users and Azure Communication Services access tokens for multitenant Microsoft Entra applications.

Before we begin:

  • Alice or her Microsoft Entra administrator needs to give Contoso's Microsoft Entra application consent before the first attempt to sign in. Learn more about consent.

Steps:

  1. Authenticate Alice using the Fabrikam application: Alice is authenticated through Fabrikam's application. A standard OAuth flow with Microsoft Authentication Library (MSAL) is used. Make sure you configure MSAL with a correct authority. If authentication is successful, the Contoso client application receives a Microsoft Entra access token with a value of A1 and an Object ID of a Microsoft Entra user with a value of A2. Token details are outlined below. Authentication from the developer perspective is explored in this quickstart.
  2. Get an access token for Alice: The Contoso application by using a custom authentication artifact with value B performs authorization logic to decide whether Alice has permission to exchange the Microsoft Entra access token for an Azure Communication Services access token. After successful authorization, the Contoso application performs control plane logic, using artifacts A1, A2, and A3. An Azure Communication Services access token D is generated for Alice within the Contoso application. This access token can be used for data plane actions in Azure Communication Services, like Calling. The A2 and A3 artifacts are passed along with the artifact A1. The validation assures that the Microsoft Entra Token was issued to the expected user. The application prevents attackers from using the Microsoft Entra access tokens issued to other applications or other users. For more information on how to get A artifacts, see Receive the Microsoft Entra user token and object ID via the MSAL library and Get an Application ID.
  3. Call Bob: Alice makes a call to Microsoft 365 user Bob, with Fabrikam's application. The call takes place via the Calling SDK with an Azure Communication Services access token. Learn more about developing apps for Microsoft 365 users in this quickstart.

Artifacts:

  • Artifact A1
    • Type: Microsoft Entra access token
    • Audience: Azure Communication Services, control plane
    • Source: Contoso application registration's Microsoft Entra tenant
    • Permission: https://auth.msft.communication.azure.com/Teams.ManageCalls, https://auth.msft.communication.azure.com/Teams.ManageChats
  • Artifact A2
    • Type: Object ID of a Microsoft Entra user
    • Source: Fabrikam's Microsoft Entra tenant
    • Authority: https://login.microsoftonline.com/<tenant>/ or https://login.microsoftonline.com/organizations/ (based on your scenario )
  • Artifact A3
    • Type: Microsoft Entra application ID
    • Source: Contoso application registration's Microsoft Entra tenant
  • Artifact B
    • Type: Custom Contoso authorization artifact (issued either by Microsoft Entra ID or a different authorization service)
  • Artifact C
  • Artifact D
    • Type: Azure Communication Services access token
    • Audience: Azure Communication Services, data plane
    • Azure Communication Services Resource ID: Contoso's Azure Communication Services Resource ID

Next steps

The following sample apps may be interesting to you:

  • Try the Sample App, which showcases a process of acquiring Azure Communication Services access tokens for Microsoft 365 users in mobile and desktop applications.

  • To see how the Azure Communication Services access tokens for Microsoft 365 users are acquired in a single-page application, check out a SPA sample app.

  • To learn more about a server implementation of an authentication service for Azure Communication Services, check out the Authentication service hero sample.