Connect Microsoft 365 to your agents for Outlook, OneDrive, Teams, and Calendar.
Overview
A Microsoft 365 credential lets agents read and send email, manage calendar events, access OneDrive files, and interact with Teams chat.
Why "Bring Your Own Key" (BYOK)?
Microsoft OAuth apps are registered in your Azure tenant. BYOK keeps credentials and permissions under your control.
Benefits:
- Your tenant — sign-in and consent happen in your Azure AD directory
- Scoped permissions — request only the Microsoft Graph scopes you need
- Your rate limits — API usage counts against your app registration
Prerequisites
Before connecting, you'll need:
- A Microsoft 365 account
- Access to the Azure Portal to register an app (admin consent may be required for some scopes)
Step 1: Register an Azure app
- Go to Azure Portal → Microsoft Entra ID → App registrations
- Click New registration
- Name your app (e.g., "Inference Agent")
- Under Supported account types, choose the audience you need (single tenant or multi-tenant)
- Click Register
- Copy the Application (client) ID
- Go to Certificates & secrets → New client secret, create a secret, and copy the value
Step 2: Configure redirect URI
- In your app, go to Authentication
- Click Add a platform → Web
- Add the redirect URI:
| Environment | Callback URL |
|---|---|
| Production | https://app.inference.sh/settings/secrets/oauth/microsoft |
| Staging | https://app.staging.inference.sh/settings/secrets/oauth/microsoft |
| Local dev | http://localhost:3000/settings/secrets/oauth/microsoft |
- Save the configuration
Step 3: Add API permissions
- Go to API permissions → Add a permission → Microsoft Graph
- Add Delegated permissions based on what your agents need (see Capabilities below)
- Click Grant admin consent if your tenant requires it
Step 4: Connect in inference shell
Configure credentials
- Go to Vault → credentials
- Find Microsoft 365 and click Configure
- Enter:
- Client ID (
MICROSOFT_CLIENT_ID) - Client Secret (
MICROSOFT_CLIENT_SECRET)
- Client ID (
- Optional: set Tenant ID (
MICROSOFT_TENANT_ID) if you use a single-tenant app. Leave blank to use thecommonendpoint (multi-tenant). - Click Save credentials
Authorize the connection
- Click Connect
- Sign in with Microsoft and approve the requested permissions
- Done — the credential status shows Connected
Capabilities
| Capability | Description | Required Scopes |
|---|---|---|
microsoft.mail.read | Read email | Mail.Read |
microsoft.mail.send | Send email | Mail.Send |
microsoft.calendar.read | Read calendar events | Calendars.Read |
microsoft.calendar.write | Create and edit events | Calendars.ReadWrite |
microsoft.files.read | Read OneDrive files | Files.Read |
microsoft.files.write | Create and edit OneDrive files | Files.ReadWrite |
microsoft.teams.read | Read Teams messages | Chat.Read |
microsoft.teams.send | Send Teams messages | Chat.ReadWrite |
Triggers
| Trigger | Description | Required Scopes |
|---|---|---|
microsoft.mail.received | New email received | Mail.Read |
microsoft.calendar.created | Calendar event created | Calendars.Read |
microsoft.teams.message | Teams message received | Chat.Read |
Using in apps
Declare Microsoft requirements in your app:
yaml
1# inf.yml2credentials:3 - key: microsoft.mail.read4 description: Read incoming email56 - key: microsoft.calendar.write7 description: Schedule meetings8 optional: trueAt runtime, your app receives:
bash
1MICROSOFT_ACCESS_TOKEN=oauth2-access-token2MICROSOFT_TOKEN_EXPIRES_AT=2026-06-03T12:00:00ZUse the token with the Microsoft Graph API.