Microsoft OneDrive
Import your OneDrive files into the SurfSense knowledge base
The OneDrive connector lets you pick files from OneDrive and index them into your knowledge base. It lives in the Documents sidebar's Import menu, not the connector catalog.
This setup is only needed on self-hosted deployments. On SurfSense Cloud, just use Import → OneDrive.
Step 1: Create an Azure App Registration
- Navigate to portal.azure.com
- Search for "App registrations" and open it
- Click "+ New registration" and fill in:
| Field | Value |
|---|---|
| Name | SurfSense |
| Supported account types | "Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts" |
| Redirect URI | Platform: Web, URI: http://localhost:3929/api/v1/auth/onedrive/connector/callback |
http://localhost:3929 is the default public URL of a Docker install. If you run SurfSense manually, use your backend URL (http://localhost:8000); in production, use your public domain.
- Click "Register"
Step 2: Get the Application (Client) ID
On the app's Overview page, copy the Application (client) ID — this is your Client ID.
Step 3: Create a Client Secret
- Under Manage, click "Certificates & secrets"
- On the "Client secrets" tab, click "+ New client secret"
- Enter a description (e.g.,
SurfSense) and pick an expiration period - Click "Add"
- Important: Copy the secret Value immediately — it will not be shown again!
Step 4: Configure API Permissions
- Under Manage, click "API permissions" > "+ Add a permission"
- Select "Microsoft Graph" > "Delegated permissions"
- Add all of the following:
| Permission | Description |
|---|---|
Files.Read.All | Read all files the user can access |
Files.ReadWrite.All | Read and write all files the user can access |
offline_access | Maintain access to granted data |
User.Read | Sign in and read user profile |
- Click "Add permissions"
All four permissions are required. The connector will not authenticate successfully if any are missing.
Step 5: Add the Credentials to SurfSense
Add the credentials to your .env file:
MICROSOFT_CLIENT_ID=your_microsoft_client_id
MICROSOFT_CLIENT_SECRET=your_microsoft_client_secretRestart SurfSense, open Documents → Import → OneDrive, and authorize:
docker compose up -dNever share your client secret publicly or include it in code repositories.