Connecting to EXO using an existing OAuth 2.0 token

Hi folks, we are developing an application to assist our IT helpdesk technicians with spam-blocking tasks they presently do manually.

Our app is hosted in Amazon S3 and uses the Microsoft Graph API on the client side to acquire OAuth access and refresh tokens. We are currently using the authorization code flow.

We want to use Security & Compliance Center to perform content searches as part of our spam-blocking tool. Security & Compliance Center is mostly a hard requirement. (To my knowledge there’s no way to do this using the Graph API.)

To my knowledge, in order to connect to Security & Compliance in PowerShell, we have to connect to ExchangeOnlineManagement first. I’ve tried many different things to pass the existing OAuth access token but no dice.

PowerShell code would be running in an AWS Lambda function.

Any solution would be appreciated. I’m open to using a second authentication solution if we need to use it for Security & Compliance. (There’s no guarantee we’ll be open to any other particular platform change.)