How to Connect-ExchangeOnline to exchange online with token?

Dino 80 Reputation points
2023-05-15T07:36:38.4266667+00:00

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
    2023-05-16T05:39:29.88+00:00

    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