Skip to content

Microsoft 365 Setup

Create an Azure AD application for Microsoft 365 APIs including Outlook Mail, Calendar, OneDrive, Contacts, Teams, and SharePoint.

  1. Access Azure Portal

    Go to the Azure Portal and sign in with your Microsoft 365 admin account.

  2. Register New Application

    Navigate to Azure Active Directory → App registrations → New registration:

    • Name: Fp Switchboard
    • Supported account types: Accounts in any organizational directory and personal Microsoft accounts
    • Click “Register”
  3. Add Redirect URI

    Under Authentication, add a Web platform with the redirect URI:

    https://api.switchboard.fpdigital.ai/oauth/microsoft365/callback
  4. Configure API Permissions

    Go to API permissions → Add permission → Microsoft Graph → Delegated permissions. Add these scopes:

    User.Read
    Mail.Read
    Mail.ReadWrite
    Mail.Send
    Calendars.Read
    Calendars.ReadWrite
    Files.Read
    Files.ReadWrite
    Contacts.Read
    Contacts.ReadWrite
    People.Read
    Team.ReadBasic.All
    Channel.ReadBasic.All
    ChannelMessage.Read.All
    ChannelMessage.Send
    Chat.ReadWrite
    ChatMessage.Read
    ChatMessage.Send
    OnlineMeetings.ReadWrite
    Sites.Read.All
    Sites.ReadWrite.All
    offline_access
  5. Grant Admin Consent

    Click “Grant admin consent for [your organization]” if you want all users to use the app without individual consent.

  6. Create Client Secret

    Go to Certificates & secrets → New client secret:

    • Create a secret with your preferred expiration
    • Copy the Value immediately (it won’t be shown again)
  7. Copy Application Details

    From the Overview page, copy the Application (client) ID.

Terminal window
npx wrangler secret put MICROSOFT_CLIENT_ID
npx wrangler secret put MICROSOFT_CLIENT_SECRET
VariableDescription
MICROSOFT_CLIENT_IDApplication (client) ID from Azure AD
MICROSOFT_CLIENT_SECRETClient secret value from Certificates & secrets
https://api.switchboard.fpdigital.ai/oauth/microsoft365/callback

Teams and SharePoint use the same Azure AD app credentials. No additional setup is needed - the scopes listed above include Teams and SharePoint permissions.

  • Access tokens expire after 1 hour
  • Refresh tokens are long-lived and automatically used
  • Multi-tenant apps can authenticate users from any Azure AD tenant
  • Personal Microsoft accounts are also supported with some API limitations