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).
The following sequence diagram details single-tenant authentication.
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:
- 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 ofA2
. Tokens are outlined later in this article. Authentication from the developer perspective is explored in this quickstart. - 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 artifactsA1
,A2
, andA3
. Azure Communication Services access tokenD
is generated for Alice within the Fabrikam application. This access token can be used for data plane actions in Azure Communication Services, like Calling. TheA2
andA3
artifacts are passed along with the artifactA1
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 getA
artifacts, see Receive the Microsoft Entra user token and object ID via the MSAL library and Get an Application ID. - 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
- Type: Azure Communication Services resource authorization artifact.
- Source: "Authorization" HTTP header with either a bearer token for Microsoft Entra authentication or a Hash-based Message Authentication Code (HMAC) payload and a signature for access key-based authentication.
- 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.
The following sequence diagram details multitenant authentication.
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:
- 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 ofA2
. Token details are outlined below. Authentication from the developer perspective is explored in this quickstart. - 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 artifactsA1
,A2
, andA3
. An Azure Communication Services access tokenD
is generated for Alice within the Contoso application. This access token can be used for data plane actions in Azure Communication Services, like Calling. TheA2
andA3
artifacts are passed along with the artifactA1
. 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 getA
artifacts, see Receive the Microsoft Entra user token and object ID via the MSAL library and Get an Application ID. - 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>/
orhttps://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
- Type: Azure Communication Services resource authorization artifact.
- Source: "Authorization" HTTP header with either a bearer token for Microsoft Entra authentication or a Hash-based Message Authentication Code (HMAC) payload and a signature for access key-based authentication
- 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
- Learn more about authentication.
- Try this quickstart to authenticate Microsoft 365 users.
- Try this quickstart to call a Microsoft 365 user.
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.