How to Connect-ExchangeOnline to exchange online with token?

Dino 80 Reputation points

I'm trying to connect to the Exchange server by Powershell with the token, below is my cmd.

Connect-ExchangeOnline -Organization <Organization> -AccessToken <.....> -AppId <.....>

It returned Unauthorized and I'm not sure what I'm missing here, I Hope someone can help me in this field

User's image

Microsoft Exchange Online
0 comments No comments
{count} votes

Accepted answer
  1. Aholic Liang-MSFT 13,831 Reputation points Microsoft Vendor

    Hi @ Dino,

    Just want to confirm that you have Global Admin or Exchange Admin roles assigned to applications that need to connect to Exchange online PowerShell?


    In addition, according to the official documentation, I  recommended that you use the certificate thumbprint replacement accesstoken to connect to Exchange online powershell to see if it is successful.

    Please refer to this link for specific steps:

    App-only authentication in Exchange Online PowerShell and Security & Compliance PowerShell | Microsoft Learn

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful