---
title: "Configure OAuth U2M: Custom-managed for Microsoft OneDrive ingestion"
description: "Learn how to configure OAuth U2M: Custom-managed authentication for Microsoft OneDrive ingestion into Databricks."
canonical_url: https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/onedrive-source-setup-u2m
---

# Configure OAuth U2M: Custom-managed for Microsoft OneDrive ingestion

> [!NOTE]
> **Beta**
>
> This feature is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md). Workspace admins can control access to this feature from the **Previews** page by opting into the **Lakeflow Connect for OneDrive For Business** preview. See [Manage Databricks previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md).

This page describes how to configure OAuth U2M: Custom-managed authentication for Microsoft OneDrive ingestion into Databricks. Use this method when your organization requires control over the OAuth application, such as owning the app registration in your Microsoft Entra ID tenant, or when **OAuth U2M: Databricks-managed** isn't available in your workspace.

> [!TIP]
>
> For most users, Databricks recommends [OAuth U2M: Databricks-managed](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/onedrive-source-setup-u2m-databricks-managed.md), which requires no Microsoft Entra ID app registration.

## Prerequisites

* Permission to register applications in your Microsoft Entra ID tenant.
* The URL of the Databricks workspace where you create the connection, for example `https://<databricks-instance>`.
* A Microsoft work or school account that can access the OneDrive for Business **My files** drive you want to ingest.

## <a id="create-client" />Step 1: Create a Microsoft Entra ID client

This step creates a client that can access the OneDrive files.

1. In the Microsoft Azure portal ([https://portal.azure.com](https://portal.azure.com)), click **Microsoft Entra ID**. You might have to search for "Microsoft Entra ID".

   ![Azure portal: Entra ID card](https://docs.databricks.com/aws/en/images/lakeflow-connect/sharepoint-azure-portal.png)

2. In the left-hand menu, under the **Manage** section, click **App registrations**.

3. Click **New registration**.

   ![New registration button for Entra ID app](https://docs.databricks.com/aws/en/images/lakeflow-connect/sharepoint-new-oauth-app-registration.png)

4. In the **Register an application** form, specify the following:
   * **Name**: A name for the app.
   * **Supported account types**: Select **Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant)**. The connector signs in through the Microsoft `organizations` endpoint, so an app registered for a single tenant can't complete sign-in.
   * **Redirect URI**: Select the **Web** platform and enter the redirect URL in the following format: `<databricks-instance-url>/login/oauth/connectors/onedrive.html`

5. Click **Register**.

   You're redirected to the app details page.

6. Make a note of the **Application (client) ID**.

## <a id="client-secret" />Step 2: Create a client secret

1. Click **Client credentials : Add a certificate or secret**.

2. Click **+ New client secret**.

3. Add a description.

4. Click **Add**.

   The updated list of client secrets displays.

5. Copy the client secret value and store it securely. After you leave the page, you can't access the client secret.

> [!NOTE]
>
> The connection uses the client secret to refresh its access token. Before the secret expires, create a new secret and update the connection with it.

## <a id="api-permissions" />Step 3: Add Microsoft Graph permissions

The connection requests the delegated Microsoft Graph permissions `Files.Read.All` and `offline_access` when a user signs in. Add these permissions to the app so that a Microsoft Entra ID administrator can grant consent for your organization.

1. In the left-hand menu, under the **Manage** section, click **API permissions**.
2. Click **+ Add a permission**.
3. Click **Microsoft Graph**, and then click **Delegated permissions**.
4. Search for and select **Files.Read.All** and **offline\_access**.
5. Click **Add permissions**.
6. If your tenant doesn't allow users to consent to apps, a Microsoft Entra ID administrator must click **Grant admin consent for \<tenant>**.

## Next steps

1. [Create a connection](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/onedrive-connection.md#u2m-custom-managed) to store the authentication details that you've obtained.
2. [Create an ingestion pipeline](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/onedrive-pipeline.md).
