Microsoft Entra Service Principal credentials
The Microsoft Entra Service Principal credential gives n8n app-only access to Microsoft Graph. Instead of signing in as a person, n8n authenticates as an app registration that an administrator sets up once in the Microsoft Entra admin center. This suits unattended and shared workflows: there's no user session to expire and no per-user consent to manage.
You can use these credentials to authenticate the following nodes:
Prerequisites
A Microsoft 365 organization tenant. Personal Microsoft accounts don't support application permissions.
Access to the Microsoft Entra admin center as an administrator who can create app registrations and grant admin consent, or an administrator who can grant consent for you.
Supported authentication methods
OAuth2 client credentials, using a client secret or a certificate (signed client assertion)
Related resources
Refer to Microsoft's documentation for more information:
Get access without a user: how app-only authentication works
How app-only access differs from OAuth2
With the OAuth2 Microsoft credentials, nodes act as the user who signed in. With the Service Principal credential, there's no signed-in user, which changes how you use the nodes:
You choose who or what to act on. Each node shows an extra required parameter when you select this credential: Access As (a user or drive) in Microsoft OneDrive, Microsoft OneDrive Trigger, and Microsoft Excel (OneDrive), Mailbox in Microsoft Outlook and Microsoft Outlook Trigger, and User in Microsoft To Do. Enter a user principal name (UPN), for example
jane@contoso.com, or a user object ID. In the Access As field you can instead select Drive and enter a drive ID. There's no list picker for these fields: paste the value directly. In the Microsoft Teams nodes, the Authentication option is labelled Service Principal (App-Only), the Task operations hide the Team picker and replace the Plan, Bucket, and Assigned To pickers with plain ID fields, and the Online Meeting operations add an Organizer field for the user whose meetings the app manages.Permissions apply tenant-wide. Application permissions aren't scoped to one user. For example, the
Mail.Sendapplication permission lets the app send as any mailbox in the tenant unless you restrict it with an Exchange Online application access policy. n8n recommends scoping tenant-wide mail permissions with an application access policy.Pickers see the whole tenant. For example, the Microsoft Teams Team picker lists every team in the organization, not just teams the app has joined.
Some operations aren't available. The nodes hide anything that only exists for a signed-in user, such as drive search or Teams chats, or block it with an explanatory error. Refer to Operations not available with app-only access.
Set up the app registration
Complete these steps in the Microsoft Entra admin center before you create the credential in n8n. To set up an app registration for the Microsoft SharePoint node from the command line instead, refer to Provision a SharePoint app registration with the Azure CLI.
Register an app
Open the Microsoft Entra admin center and go to Entra ID > App registrations.
Select New registration.
Enter a Name for your app, for example
n8n service principal.In Supported account types, select Accounts in this organizational directory only. You don't need a redirect URI.
Select Register.
On the app's Overview page, copy the Application (client) ID and the Directory (tenant) ID. You'll need both in n8n.
Add application permissions
In your app registration, select API permissions > Add a permission > Microsoft Graph.
Select Application permissions. Don't select Delegated permissions: app-only access ignores delegated scopes, and the permission names differ between the two types.
Add the permissions for the nodes you plan to use. Refer to Required application permissions by node.
Select Add permissions.
Grant admin consent
On the API permissions page, select Grant admin consent for
<your-tenant>and confirm.Check that the Status column shows Granted for every permission.
Create a client secret
In your app registration, select Certificates & secrets > Client secrets > New client secret.
Enter a Description, for example
n8n credential, and choose an expiry.Select Add.
Copy the secret's Value right away. Microsoft only shows it once.
Create the credential in n8n
In n8n, create a new Microsoft Entra Service Principal credential and fill in these fields:
Directory (Tenant) ID: the Directory (tenant) ID from your app registration's Overview page. You can also use a verified domain, for example
contoso.onmicrosoft.com.Application (Client) ID: the Application (client) ID from your app registration's Overview page.
Client Secret: the client secret value you copied.
Microsoft Graph API Base URL: keep Global unless your tenant is in a sovereign cloud. Refer to Sovereign cloud environments.
To authenticate with a certificate instead of a client secret, set Authentication to Certificate and paste your private key and certificate. The certificate must be uploaded to the app registration under Certificates & secrets.
Save and test the credential. From n8n 2.40.0, the connection test only checks that the app can sign in, so it needs no application permission of its own. A missing permission or missing admin consent passes the test and fails when a node runs instead. Before n8n 2.40.0, the test read your organization from Microsoft Graph, so it also needed the Organization.Read.All (or Directory.Read.All) application permission.
Required application permissions by node
Add the application permissions for every node you plan to use, then grant admin consent. All permissions in this table are Microsoft Graph Application permissions, not Delegated permissions.
All nodes, before n8n 2.40.0 (credential test)
Organization.Read.All or Directory.Read.All. From n8n 2.40.0, the credential test needs no application permission.
Microsoft OneDrive and Microsoft OneDrive Trigger
Files.ReadWrite.All (Files.Read.All is enough for read-only operations and the trigger)
Microsoft Excel (OneDrive)
Files.ReadWrite.All
Microsoft Outlook
Mail.ReadWrite (messages, drafts, folders, and attachments; also required by Reply and Draft: Send, which create or update a draft before sending), Mail.Send (send and reply), Calendars.ReadWrite (calendars and events), Contacts.ReadWrite (contacts), MailboxSettings.Read (loads the Categories dropdown). Add only the ones your operations use.
Microsoft Outlook Trigger
Mail.Read
Microsoft SharePoint
Sites.Read.All for read operations, Sites.ReadWrite.All for write operations. For items in document libraries, Files.Read.All (Item: Get) or Files.ReadWrite.All (Item: Delete) also works. To limit the app to chosen sites, grant Sites.Selected instead and refer to Grant access per site.
Microsoft SharePoint Trigger
Sites.Read.All. To limit the app to chosen sites, grant Sites.Selected instead and refer to Grant access per site.
Microsoft Teams and Microsoft Teams Trigger
Team.ReadBasic.All, plus the permissions for your operations in the table below
Microsoft To Do
Tasks.ReadWrite.All
The Microsoft Teams node needs Team.ReadBasic.All to list teams, plus a permission per operation:
Activity Notification: Send
TeamsActivity.Send, plus User.Read.All to pick the recipient from the list. The recipient also needs a companion Teams app installed. Refer to Send an activity notification.
Channel: Get, Get Many
Channel.ReadBasic.All
Channel: Create
Channel.Create
Channel: Update
ChannelSettings.ReadWrite.All
Channel: Delete
Channel.Delete.All
Channel Message: Get, Get Many, Get Many Replies
ChannelMessage.Read.All
Online Meeting: Create, Create or Get, Update, Delete
OnlineMeetings.ReadWrite.All, plus an application access policy for the organizer. Refer to Allow app-only online meetings.
Online Meeting: Get
OnlineMeetings.Read.All (or OnlineMeetings.ReadWrite.All), plus an application access policy for the organizer
Online Meeting: Organizer picked from the list or given by user principal name
User.Read.All. Not needed when you enter the organizer's object ID.
Task: all operations
Tasks.ReadWrite.All
Trigger: New Channel
Channel.ReadBasic.All
Trigger: New Channel Message
ChannelMessage.Read.All
Trigger: New Team Member
TeamMember.Read.All
Grant access per site
Tenant-wide Sites.Read.All or Sites.ReadWrite.All gives the app access to every SharePoint site in your organization. If your security team prefers to grant access site by site, use the Sites.Selected permission instead. The Microsoft SharePoint node (from version 2), the Microsoft SharePoint Trigger node, and the Microsoft Excel (SharePoint) node support it.
Per-site access takes two steps. The second step has no page in the Entra admin center or the SharePoint admin center, which is why many setups miss it:
Add the permission and grant admin consent. On the app registration, add the
Sites.Selectedapplication permission in place of the tenant-wideSites.*permissions, and grant admin consent.Grant the app access to each site. An administrator calls Microsoft Graph's site permissions endpoint once per site the app should reach:
Use the read role for read-only access, or write for the node's write operations. You can send the request from Graph Explorer or any tool that can call Microsoft Graph. SharePoint administrators can use PnP PowerShell's Grant-PnPEntraIDAppSitePermission instead. For the whole path from an empty tenant to a granted site, refer to Provision a SharePoint app registration with the Azure CLI.
Whoever sends the request needs permission to manage site permissions: in Graph Explorer, open Modify permissions and consent to Sites.FullControl.All before sending. A 403 Access denied response to this request means the account or tool sending it lacks that permission, not the app you're granting access to.
To find a site's <site-id>, request it by hostname and path: GET https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/mysite.
With Sites.Selected, the nodes can't search or list sites, because Microsoft Graph doesn't support site discovery without a tenant-wide read permission. Choose the site by pasting its URL or ID instead. A missing per-site grant surfaces as a 403 error on the operation, naming the permission it needs.
Allow app-only online meetings
With this credential, the Microsoft Teams node's Online Meeting operations act on behalf of the user you select in the node's Organizer field. The Microsoft Teams node supports this from n8n 2.40.0. Microsoft Graph only allows it when a Teams administrator has granted the app an application access policy for that user. Without one, every Online Meeting operation fails with a 403 error, and n8n reports that the request needs the OnlineMeetings.ReadWrite.All permission and an application access policy for the organizer.
To set it up:
On the app registration, add the
OnlineMeetings.ReadWrite.Allapplication permission and grant admin consent.OnlineMeetings.Read.Allis enough if you only use the Get operation. AddUser.Read.Alltoo if you want to pick the organizer from the list or enter a user principal name instead of an object ID.Install the Microsoft Teams PowerShell module and sign in as a Teams administrator:
Create an application access policy that lists your app registration's Application (client) ID:
Grant the policy to each user the node should act for, by their user object ID:
To cover every user in the tenant who doesn't have their own policy, grant it tenant-wide instead:
Policy changes can take up to 30 minutes to take effect. A user holds one application access policy at a time, so granting a new policy replaces the one they had. If several apps need access, list all their IDs in the same policy.
Operations not available with app-only access
Some Microsoft Graph operations only exist for a signed-in user. When you select this credential, the nodes hide or block them with an explanatory error. Use an OAuth2 credential if you need them:
Microsoft OneDrive: File: Search and Folder: Search. Microsoft Graph only offers drive search to signed-in users.
Microsoft Excel (OneDrive): Workbook: Get Many, and searching for a workbook by name in the Workbook field. Set the field to By ID instead.
Microsoft Teams: the whole Chat, Chat Member, and Chat Message resources. Channel Message: Create, Reply, Delete, and Undo Delete. Task: Get Many in Group Member mode. Online Meeting operations are available, but need an application access policy. Refer to Allow app-only online meetings.
Microsoft Teams Trigger: the New Chat and New Chat Message events, and the watch-all options. Pick a specific team or channel instead.
The Microsoft Outlook, Microsoft Outlook Trigger, Microsoft SharePoint, Microsoft SharePoint Trigger, and Microsoft To Do nodes have no blocked operations. In the Microsoft SharePoint node, site search needs the Sites.Read.All application permission; with only Sites.Selected, choose the site by URL or ID instead.
File: Share and Folder: Share in Microsoft OneDrive stay available, but creating sharing links app-only can need extra tenant or admin configuration. The node shows a notice on these operations.
Sovereign cloud environments
Select the Microsoft Graph API Base URL that matches your tenant's cloud environment:
Global (
https://graph.microsoft.com): standard Microsoft 365 tenants (default)US Government (
https://graph.microsoft.us): Azure US Government tenants, including GCC HighUS Government DOD (
https://dod-graph.microsoft.us): Azure US Government Department of Defense tenantsChina (
https://microsoftgraph.chinacloudapi.cn): Microsoft 365 operated by 21Vianet in China
n8n derives the matching sign-in endpoint automatically, for example login.microsoftonline.us for the US Government clouds and login.partner.microsoftonline.cn for China, so you don't need to configure any token or authorization URLs. Complete the app registration in your cloud's own Entra admin center, and the nodes route all Microsoft Graph calls through the endpoint you selected.
Common issues
Here are common errors and issues with the Microsoft Entra Service Principal credentials:
The credential test passes but every operation fails. From n8n 2.40.0, the connection test only checks that the app can sign in, not which permissions it holds. A missing application permission, missing admin consent, or a missing per-site grant only surfaces when a node runs.
Every operation fails with a generic permissions error. This almost always means a missing application permission or missing admin consent. Refer to the warning in Grant admin consent. The Microsoft SharePoint (version 2) and Microsoft Excel (SharePoint) nodes show a clearer message instead, naming the permission the operation needs: "The app registration is missing a consented application permission for this operation."
Authentication fails with "Microsoft Entra authentication did not return an access token". Microsoft rejected the token exchange, for example AADSTS7000215 (invalid client secret), AADSTS7000222 (expired client secret), or AADSTS700027 (rejected certificate assertion). Check that you pasted the client secret's Value rather than its Secret ID, that the secret hasn't expired, and, for certificate authentication, that the private key matches the certificate uploaded to the app registration.
Permission or secret changes don't take effect right away. n8n caches the access token. Retest the credential after granting consent or rotating a secret, and recreate it if the cached token keeps failing.
"Microsoft Entra tenant ID is not a valid GUID or domain." Enter the Directory (tenant) ID GUID from the app registration's Overview page, or a verified domain such as
contoso.onmicrosoft.com. Don't enter a URL.Online Meeting operations in the Microsoft Teams node fail with a 403 error. The app registration needs the
OnlineMeetings.ReadWrite.Allapplication permission and a Microsoft Teams application access policy for the organizer. Refer to Allow app-only online meetings. Policy changes can take up to 30 minutes to take effect.
Last updated
Was this helpful?