Share via


Configure user authentication with Microsoft Entra ID

Adding authentication to your agent allows users to sign in, giving your agent access to a restricted resource or information.

This article covers how to configure Microsoft Entra ID as your service provider. To learn about other service providers and user authentication in general, see Configure user authentication in Copilot Studio.

If you have tenant administration rights, you can configure API permissions. Otherwise, you need to ask a tenant administrator to do it for you.

Prerequisites

Learn how to add user authentication to a topic

You complete the first several steps in the Azure portal, and complete the final two steps in Copilot Studio.

Create an app registration

  1. Sign in to the Azure portal, using an admin account in the same tenant as your agent.

  2. Go to App registrations.

  3. Select New registration and enter a name for the registration. Don't alter existing app registrations.

    It can be helpful later to use the name of your agent. For example, if your agent is called "Contoso sales help," you might name the app registration "ContosoSalesReg."

  4. Under Supported account types, select Accounts in this organizational directory only (Contoso only - Single tenant).

  5. Leave the Redirect URI section blank for now. Enter that information in the next steps.

  6. Select Register.

  7. After the registration is complete, go to Overview.

  8. Copy the Application (client) ID and paste it in a temporary file. You need it in later steps.

Add the redirect URL

  1. Under Manage, select Authentication.

  2. Under Platform configurations, select Add a platform, and then select Web.

  3. Under Redirect URIs, enter https://token.botframework.com/.auth/web/redirect or https://europe.token.botframework.com/.auth/web/redirect for Europe. You can also copy the URI from Redirect URL textbox under Copilot Studio Security setting page under Authenticate manually.

    This action takes you back to the Platform configurations page.

  4. Select both Access tokens (used for implicit flows) and ID tokens (used for implicit and hybrid flows).

  5. Select Configure.

Configure manual authentication

Next, configure manual authentication. You can choose from multiple options for your provider, however we recommend you use Microsoft Entra ID V2 with federated credentials. You can also use client secrets if you're unable to use federated credentials.

Configure manual authentication using federated credentials

  1. In Copilot Studio, go to Settings for your agent, and select Security.

  2. Select Authentication.

  3. Select Authenticate manually.

  4. Leave Require users to sign in on.

  5. Enter the following values for the properties:

    • Service provider: Select Microsoft Entra ID V2 with federated credentials.

    • Client ID: Enter the application (client) ID that you copied earlier from the Azure portal.

  6. Select Save to see the federated credential issuer and value.

  7. Copy the Federated credential issuer and Federated credential value and paste it in a temporary file. You need it in later steps.

  8. In Azure portal, under Manage, select Federated credentials.

  9. Select Add credential.

  10. Under Federated credential scenario, select Other issuer.

  11. Enter the following values for the properties:

    • Issuer: Enter the federated credential issuer value that you copied earlier from Copilot Studio.
    • Value: Enter the federated credential value data that you copied earlier from Copilot Studio.
    • Name: Provide a name.
  12. Select Add to finish the configuration.

Configure API permissions

  1. Go to API permissions.

  2. Select Grant admin consent for <your tenant name>, and then select Yes. If the button isn't available, you might need to ask a tenant administrator to do enter it for you.

    Screenshot of the API permissions window with a tenant permission highlighted.

    Important

    To avoid users having to consent to each application, someone assigned at least the Application Administrator or Cloud Application Administrator role can grant tenant-wide consent to your application registrations.

  3. Select Add a permission, and then select Microsoft Graph.

    Screenshot of the Request API permissions window with Microsoft Graph highlighted.

  4. Select Delegated permissions.

    Screenshot with Delegated permissions highlighted.

  5. Expand OpenId permissions and turn on openid and profile.

    Screenshot with OpenId permissions, openid, and profile highlighted.

  6. Select Add permissions.

Define a custom scope for your agent

Scopes allow you to determine user and admin roles and access rights. You create a custom scope for the canvas app registration that you create in a later step.

  1. Go to Expose an API and select Add a scope.

    Screenshot with Expose an API and the Add a scope button highlighted.

  2. Set the following properties. You can leave the other properties blank.

    Property Value
    Scope name Enter a name that makes sense in your environment, such as Test.Read
    Who can consent? Select Admins and users
    Admin consent display name Enter a name that makes sense in your environment, such as Test.Read
    Admin consent description Enter Allows the app to sign the user in.
    State Select Enabled
  3. Select Add scope.

Configure authentication in Copilot Studio

  1. In Copilot Studio, under Settings, select Security > Authentication.

  2. Select Authenticate manually.

  3. Leave Require users to sign in on.

  4. Select a Service provider and provide the required values. See Configure manual authentication in Copilot Studio.

  5. Select Save.

Tip

The token exchange URL is used to exchange the On-Behalf-Of (OBO) token for the requested access token. For more information, see Configure single sign-on with Microsoft Entra ID.

Note

The scopes should include profile openid and the following, depending on your use case:

  • Sites.Read.All Files.Read.All for SharePoint
  • ExternalItem.Read.All for Graph Connection
  • https://[OrgURL]/user_impersonation for Dataverse structured data

For example, Dataverse Structure Data should have the following scopes: profile openid Sites.Read.All Files.Read.All https://myorg123.com/user_impersonation

Test your agent

  1. Publish your agent.

  2. In the Test your agent panel, send a message to your agent.

  3. When the agent responds, select Login.

    A new browser tab opens, asking you to sign in.

  4. Sign in, and then copy the displayed validation code.

  5. Paste the code in the agent chat to complete the sign-in process.

    Screenshot of a successful user authentication in an agent conversation, with the validation code highlighted.