| title | description | keywords | ms.date | ms.topic | author | ms.author | ms.reviewer | ms.custom | ms.service | ms.collection |
|---|---|---|---|---|---|---|---|---|---|---|
Configure single sign-on for the Power Virtual Agents app in Teams |
Enable your bot to authenticate an already-signed-in Teams user |
Single Sign-on, Teams SSO, User Authentication, Authentication, AAD, MSA, Identity Provider, PVA |
08/18/2022 |
article |
iaanw |
iawilt |
kamrani |
authentication, ceX |
power-virtual-agents |
virtual-agent |
Configure single sign-on with Azure Active Directory for Power Virtual Agents bots in Microsoft Teams
The Power Virtual Agents app in Microsoft Teams supports single sign-on (SSO), which means bots can automatically sign-in users with their Microsoft Teams credentials.
SSO in the Power Virtual Agents app in Teams is only supported when using Azure Active Directory (Azure AD) v2. Other service providers, such as Azure AD v1, don't support SSO in the Power Virtual Agents app in Microsoft Teams.
Important
SSO is not supported when your bot is integrated with Dynamics 365 Customer Service.
- Learn more about what you can do with Power Virtual Agents.
- Learn how to use user authentication in a topic.
- Add your bot to Microsoft Teams.
Before you can turn on SSO, you'll need to configure user authentication with Azure AD. During this process, you'll create an app registration which you'll use to setup SSO.
- Create an app registration.
- Add the redirect URL.
- Generate a client secret.
- Configure manual authentication.
Follow the instructions in Configure user authentication with Azure AD then return to this article.
-
In Power Virtual Agents, open the bot that you want to configure SSO for.
-
In the navigation menu under Settings, select Channels. Select the Microsoft Teams tile.
-
Select Edit details, expand More, and then copy the App ID by selecting Copy.
:::image type="content" source="media/configure-sso-teams/copy-teams-channel-app-id.png" alt-text="Screenshot of the Teams channel details pane, with the App ID copy button highlighted.":::
Note
If you haven't already turned on the Microsoft Teams channel, you'll be notified that it's currently turned off. Select Turn on Teams and then re-try step 1 to get the app ID.
:::image type="content" source="media/configure-sso-teams/turn-on-teams-channel.png" alt-text="Screenshot of the Teams channel pane showing that the channel is turned off.":::
-
Go to the Azure portal. Open the app registration blade for the app registration you created when you configured user authentication for your bot.
-
Select Expose an API on the side pane. For Application ID URI, select Set.
:::image type="content" source="media/configure-sso-teams/set-app-id-uri.png" alt-text="Screenshot of the location of the Set button for the Application ID URI.":::
-
Enter
api://botid-{teamsbotid}and replace{teamsbotid}with your Teams channel app ID that you found earlier.:::image type="content" source="media/configure-sso-teams/enter-app-id-uri.png" alt-text="Screenshot of a correctly formatted URI entered into the Application ID URI box.":::
-
Select Save.
Applications are authorized to call APIs when they are granted permissions by users/admins as part of the consent process. To learn more about consent, see Permissions and consent in the Microsoft identity platform
The admin consent option may be greyed out if it's not enabled by your tenant administrator. However, if it's available, you'll need to grant consent:
-
In the Azure portal on your app registration blade, go to API Permissions.
-
Select Grant admin consent for <your tenant name> and then Yes.
:::image type="content" source="media/configure-sso-teams/grant-admin-consent.png" alt-text="Screenshot of the Grant admin consent button highlighted.":::
Tip
To avoid users from having to consent to each application, a Global Administrator, Application Administrator, or a Cloud Application Administrator can grant tenant-wide consent to your application registrations.
-
In the Azure portal on your app registration blade, go to API Permissions.
-
Select Add a permission and choose Microsoft Graph.
-
Select Delegated permissions. A list of permissions will appear below. Expand OpenId permissions and turn on openid and profile.
-
Select Add permissions.
:::image type="content" source="media/configure-sso-teams/add-permissions.png" alt-text="Screenshot of the openid and profile permissions turned on.":::
-
In the Azure portal on your app registration blade, go to Expose an API.
-
Select Add a scope.
:::image type="content" source="media/configure-sso-teams/add-a-scope.png" alt-text="Screenshot of the Add a scope button highlighted.":::
-
Set the following properties:
Property Value Scope name Enter Test.ReadWho can consent? Select Admins and users Admin consent display name Enter Test.ReadAdmin consent description Enter Allows the app to log in the user.State Select Enabled [!NOTE] The scope name
Test.Readis a placeholder value and should be replaced with a name that makes sense in your environment. -
Select Add scope.
Important
In the following steps, the values provided for Microsoft Teams client IDs should be used literally because they are the same across all tenants.
-
In the Azure portal on your app registration blade, go to Expose an API and select Add a client application.
:::image type="content" source="media/configure-sso-teams/add-client-application.png" alt-text="Screenshot of the Add a client application button highlighted.":::
-
In the Client ID field, enter the client ID for Microsoft Teams mobile/desktop, which is
1fec8e78-bce4-4aaf-ab1b-5451cc387264. Select the checkbox for the scope that you created earlier.:::image type="content" source="media/configure-sso-teams/enter-client-id.png" alt-text="Screenshot of the client ID entered into the Add a client application pane.":::
-
Select Add application.
-
Repeat the steps above, but for Client ID, enter the client ID for Microsoft Teams on the web, which is
5e3ce6c0-2b1f-4285-8d4b-75ee78787346. -
Confirm the Expose an API page lists the Microsoft Teams client app IDs.
:::image type="content" source="media/configure-sso-teams/client-ids-added.png" alt-text="Screenshot of the Expose an API page that correctly lists the Microsoft Teams client IDs.":::
To update the Azure AD authentication settings in Power Virtual Agents, you'll need to add the token exchange URL to allow Microsoft Teams and Power Virtual Agents to share information.
-
In the Azure portal on your app registration blade, go to Expose an API.
-
Under Scopes, select Copy to clipboard.
:::image type="content" source="media/configure-sso-teams/copy-scope.png" alt-text="Screenshot of the Copy to clipboard button..":::
-
In Power Virtual Agents, in the navigation menu under Settings, select Security, and then select the Authentication tile.
-
For Token exchange URL (required for SSO), paste the scope you copied earlier.
:::image type="content" source="media/configure-sso-teams/token-exchange-url.png" alt-text="Screenshot of the Application ID URI entered as the Token exchange URL in Power Virtual Agents.":::
-
Select Save.
-
In Power Virtual Agents, in the navigation menu under Settings, select Channels.
-
Select the Microsoft Teams tile. Select Edit details and expand More.
-
For AAD application's client ID, enter the Application (client) ID from your app registration.
:::image type="content" source="media/configure-sso-teams/add-sso-application-id.png" alt-text="Screenshot of the Application (client) ID entered as the AAD application's client ID in Power Virtual Agents.":::
To obtain this value, open the Azure portal. Then on your app registration blade, go to Overview. Copy the value in the Application (client) ID box.
:::image type="content" source="media/configure-sso-teams/azure-application-id.png" alt-text="Screenshot of where to find the Application (client) ID in Azure portal.":::
-
For Resource URI, enter the Application ID URI from your app registration.
:::image type="content" source="media/configure-sso-teams/add-sso-resource-uri.png" alt-text="Screenshot of the Application ID URI entered as the Resource URI in Power Virtual Agents.":::
To obtain this value, open the Azure portal. Then on your app registration blade, go to Expose an API. Copy the value in the Application ID URI box.
:::image type="content" source="media/configure-sso-teams/application-id-uri.png" alt-text="Screenshot of where to find the Application ID URI in Azure portal.":::
-
Select Save, and then Close.
-
In the navigation menu, select Publish.
-
Select Publish to make the latest bot content available to your customers.
-
In the navigation menu, under Settings, select Channels.
-
Select Microsoft Teams, then select Open bot.
-
Start a new conversation with your bot in Microsoft Teams to test if it automatically signs you in.
[!INCLUDEfooter-include]