> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft

> Connect your AI Agents to Microsoft services including Outlook, Teams, OneDrive, and more.

Connect your AI Agents to Microsoft services including Outlook, Teams, OneDrive, and more.

## Connect Microsoft to Auth0

**1. Azure setup**

1. [Sign up for an account on the Azure
   portal](https://azure.microsoft.com/en-us/free/?ref=microsoft.com\&utm_source=microsoft.com\&utm_medium=docs\&utm_campaign=visualstudio)
2. [Create an Azure AD
   Tenant](https://learn.microsoft.com/en-us/entra/external-id/customers/quickstart-tenant-setup)

**2. Microsoft setup**

1. Register an app in Azure using Microsoft's [Quickstart: Register an
   application with the Microsoft identity
   platform](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app)
   documentation.
2. During this process, Microsoft will generate an
   **Application (client) ID** and a **Client Secret** for your application;
   make note of these.

**3. Auth0 setup**

<ol>
  <li>In the [Auth0 Dashboard](https://manage.auth0.com), go to
  **Authentication > Social**.</li>
  <li>Select **Create Connection**, then choose **Microsoft**.</li>
  <li>Select **Continue**.</li>

  <li>
    In **General**:

    <ol type="A">
      <li>Enter the **Client ID** and **Client Secret** from
      your Microsoft OAuth app.</li>

      <li>
        Under **Permissions**, select the scope(s) required for your
        application. These determine what permissions your application can
        request from Microsoft, whether for authentication (such as
        accessing basic profile details) or for API access (such as
        connecting to the provider's APIs).

        For a Dropbox and Google social
        connection, you must select **Offline Access** in the Auth0 Dashboard, enabling
        the client application to obtain an Auth0 refresh token.
      </li>

      <li>Add any additional scopes your application requires in the
      **Additional Scopes** field.</li>
    </ol>
  </li>

  <li>In **Purpose**, toggle on **Connected Accounts for Token Vault**. This lets the
  connection retrieve and securely store access tokens for external
  APIs. Learn more in
  [Connected Accounts for Token Vault](/docs/secure/call-apis-on-users-behalf/token-vault/connected-accounts-for-token-vault).</li>
  <li>Select **Create**.</li>

  <li>
    After creation, you are redirected to the **Applications** page.
    Select the application(s) to enable this connection for.

    In a new Auth0 tenant, you can select the **Default App**.
  </li>

  <li>Once you have created your Microsoft social connection, [test your connection](/docs/authenticate/identity-providers/test-connections) to ensure the setup is working correctly before using it in your application.</li>
</ol>

This guide walks you through setting up the **Microsoft** connection in Auth0.
For an end-to-end example that shows how to set up your app to call third-party APIs on the user's behalf
using a connection like this, read the
[Call third-party APIs on user's behalf quickstart](/ai/docs/get-started/call-third-party-apis-on-users-behalf).

## Token Vault configuration example

To configure the Token Vault for your Microsoft connection, you can use the following code snippet in your application:

**JavaScript**

**Python**

## Next steps

* To learn how to configure applications to access Token Vault, read [Configure Token Vault](/docs/secure/call-apis-on-users-behalf/token-vault/configure-token-vault).
* If your application uses [Organizations](/docs/manage-users/organizations), authenticate the user with the target organization before initiating the Connected Accounts flow. Connected accounts remain linked to the individual user profile.
* To learn how to get an access token to make a tool call, complete the [Call third-party APIs on user's behalf Quickstart](/ai/docs/get-started/call-third-party-apis-on-users-behalf).
