+1 vote

I'm trying to implementat client credential flow with Office365/Exchange and IMAP:
https://www.limilabs.com/blog/oauth2-client-credential-flow-office365-exchange-imap-pop3-smtp

I run:

Connect-ExchangeOnline -UserPrincipalName user@domain.onmicrosoft.com

which then prompts me to login to the Exchange account but user@domain.onmicrosoft.com doesn't work for logging in, and when I try user@domain.com it logs in but powershell says Admin account chosen for authentication is different from the one provided as parameter during Connect-ExchangeOnline.

I believe the problem might be with my client configuration. They have Exchange in the cloud, but how it handles the users is done locally.

They referred to it as Hybrid mode.

So the problem is itadmin@domain.onmicrosoft.com isn't being recognized so how would I get it to ask for credentials if I just put in itadmin@domain.com. When I do that I don't get any message to prompt for login.

by

1 Answer

0 votes
 
Best answer

For Exchange running in hybrid mode log-in using following code:

$lc = Get-Credential
Connect-ExchangeOnline -Credential $lc
by (297k points)
...