How to move away with Personal Credentials for Outlook

Hi everyone! I am setting up an n8n workflow to read/send emails from a shared mailbox using an existing Azure App Registration.

Currently, n8n uses the Microsoft Graph Delegated permissions OAuth flow, which links the connection to my personal account. To make this automation sustainable for the whole team, is there a standard way to connect to Outlook without using personal credentials?

  • Can we provision a generic Service Account with access to the shared mailbox?
  • Or can we switch the Azure App to Application Permissions, restricted to just this mailbox via an Application Access Policy?

Any guidance on the standard IT process for this would be great. Thanks!

Hey @Neeraj_Sharma1, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@Erick_Torres, @Zelite, @tomwhi - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

@Neeraj_Sharma1 Hello!

  1. Yes, but make a dedication non personal account, give it access to the shared mailbox, and connect n8n to it with use shared inbox on. A downside is its still a signed in user so it needs a license, and can break with 2fa.

  2. This is the better option, switch the azure app to app permissions Mail.ReadWrite + Mail.Send with admin consent/permissions. n8n supports this too

Here’s the official docs! - Microsoft Entra Service Principal credentials | Nodes | n8n Docs

Microsoft docs - here

Ensure your n8n instance is above 2.29!

Okay so once I set the Application permissions in Azure AD with admin consent, I have to setup Outlook Oauth 2 credential with the shared mailbox ON. So lets say I left the company. Will the flow continue to run seamlessly after that?

As long as it’s a service principal, APP only, yes! if you do Ouath2, and its signed in as you, no, itll die when ur company acc gets deactivated

Let me know if it works! if you need any more help, please let us know! If your all good, feel free to mark any of the replies as the solution!

So what I have done is, I have created a shared mailbox and new Azure App registration with Application Permissions for mail.ReadWrite and Mail.send (Admin Consent is yet to be approved). Now in n8n, I have created a OAuth2 API credential with client credentials of azure app. From n8n I can send Http request to https://graph.microsoft.com/v1.0/users//messages?$top=5 to get the emails.
Am I going into right direction or still complicating the things?

Yea, that should work!