OneDrive
OneDrive integration gives task-runner agents read/write access to files in a user’s OneDrive. When connected, agents can list, read, create, update, and delete files and folders during task execution.
The integration uses a dedicated OneDrive MCP server that is deployed alongside Errand. The server communicates with the Microsoft Graph API using OAuth tokens managed by Errand.
Prerequisites
Section titled “Prerequisites”- The OneDrive MCP server must be deployed (enabled by default in the Helm chart and docker-compose)
- An OAuth 2.0 app registration must be created in Microsoft Entra ID (formerly Azure AD)
- The user connecting their account must have a Microsoft account with OneDrive access
Step 1: Register an application in Microsoft Entra
Section titled “Step 1: Register an application in Microsoft Entra”- Go to the Microsoft Entra admin center
- Navigate to Identity > Applications > App registrations
- Click New registration
- Configure:
- Name: e.g. “Errand OneDrive”
- Supported account types: Choose based on your needs:
- Single tenant — only users in your organization
- Multitenant — users in any Microsoft Entra directory
- Multitenant + personal Microsoft accounts — broadest access
- Redirect URI: Select platform Web and enter:
For local development:https://<your-domain>/api/integrations/onedrive/callbackhttp://localhost:8000/api/integrations/onedrive/callback
- Click Register
Step 2: Note the application IDs
Section titled “Step 2: Note the application IDs”On the app’s Overview page, note:
- Application (client) ID — this is your
MICROSOFT_CLIENT_ID - Directory (tenant) ID — this is your
MICROSOFT_TENANT_ID
If you selected Multitenant or Multitenant + personal in the previous step, you can use common as the tenant ID instead of the specific directory ID.
Step 3: Create a client secret
Section titled “Step 3: Create a client secret”- Navigate to Certificates & secrets
- Under Client secrets, click New client secret
- Add a description (e.g. “Errand”) and choose an expiry period
- Click Add
- Copy the Value immediately — it is only shown once. This is your
MICROSOFT_CLIENT_SECRET
Step 4: Configure API permissions
Section titled “Step 4: Configure API permissions”- Navigate to API permissions
- Click Add a permission
- Select Microsoft Graph > Delegated permissions
- Add the following permissions:
Files.ReadWrite.All— read and write access to all files the user can accessoffline_access— allows Errand to refresh tokens without user interaction
- If you are an admin, click Grant admin consent for [your org] to pre-approve the permissions. Otherwise, each user will be prompted to consent during the OAuth flow.
Step 5: Configure Errand
Section titled “Step 5: Configure Errand”Provide the OAuth credentials as environment variables to the Errand server.
Docker Compose
Section titled “Docker Compose”Add to your .env file:
MICROSOFT_CLIENT_ID=your-application-client-idMICROSOFT_CLIENT_SECRET=your-client-secret-valueMICROSOFT_TENANT_ID=your-directory-tenant-idThese are already wired into the errand service in docker-compose.yml. If you used a multi-tenant configuration, you can set MICROSOFT_TENANT_ID=common.
Kubernetes (Helm)
Section titled “Kubernetes (Helm)”Create a Kubernetes secret:
kubectl create secret generic errand-onedrive-oauth \ --from-literal=MICROSOFT_CLIENT_ID="your-application-client-id" \ --from-literal=MICROSOFT_CLIENT_SECRET="your-client-secret-value" \ --from-literal=MICROSOFT_TENANT_ID="your-directory-tenant-id" \ -n errandSet the secret name in your Helm values:
onedrive: enabled: true existingSecret: errand-onedrive-oauthStep 6: Connect your account
Section titled “Step 6: Connect your account”- Open the Errand UI and navigate to Settings > Integrations
- The OneDrive card should show a Connect button (if it’s greyed out, check that the environment variables are set and the MCP server is running)
- Click Connect — you’ll be redirected to Microsoft’s sign-in page
- Sign in and grant the requested permissions
- You’ll be redirected back to Errand — the card should now show your connected account
How it works
Section titled “How it works”Once connected:
- The worker loads your OneDrive credentials before each task execution
- If the OAuth access token has expired, the worker automatically refreshes it using the stored refresh token
- The OneDrive MCP server is injected into the task-runner’s MCP configuration with a fresh Bearer token
- The task-runner agent can use the MCP tools to interact with your OneDrive files
- Cloud storage instructions are appended to the system prompt to guide the agent
Task profile control
Section titled “Task profile control”Cloud storage MCP servers participate in task profile filtering. If a profile specifies an mcp_servers list, the OneDrive server (onedrive) must be included for agents using that profile to access OneDrive files.
Profiles with no mcp_servers filter include all available MCP servers by default.
Disconnecting
Section titled “Disconnecting”To disconnect your OneDrive account:
- Go to Settings > Integrations
- Click Disconnect on the OneDrive card
- The stored credentials are deleted from Errand
You can also revoke access from Microsoft’s side at account.microsoft.com/consent.
Client secret expiry
Section titled “Client secret expiry”Microsoft Entra client secrets have an expiry date (maximum 2 years). When the secret expires:
- Existing connected users continue to work (refresh tokens don’t depend on the client secret for token refresh in some flows, but new connections will fail)
- Create a new client secret in the Entra admin center and update the
MICROSOFT_CLIENT_SECRETenvironment variable - No user action is needed — existing refresh tokens remain valid
Troubleshooting
Section titled “Troubleshooting”| Issue | Solution |
|---|---|
| Card is greyed out | Check that MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, and ONEDRIVE_MCP_URL are all set |
| ”Provider not configured” error on Connect | The OAuth client credentials are not set in the server’s environment |
| ”AADSTS50011: reply URL does not match” error | The redirect URI in Entra doesn’t match exactly — check for trailing slashes and protocol (http vs https) |
| “Need admin approval” during consent | An admin must grant consent in the Entra portal, or the user must have permission to consent to apps |
| Token refresh fails after some time | The user may have revoked access or the refresh token expired — disconnect and reconnect |
| Agent reports auth errors during task | The access token may have expired mid-task (tasks longer than 1 hour) — this is a known limitation |