How to add the Exchange.ManageAsApp API autorisation

Lucien | MasterIT 20 Reputation points
2025-11-29T16:22:56.7866667+00:00

Hi,

I'd like to connect from a pwsh cli to ExchangeOnline using the Connect-ExchangeOnline command.

For now, the command :

Connect-ExchangeOnline -AppId "xxxxxxx-xx-xx" -CertificateFilePath "/theFile.pfx" -CertificatePassword (ConvertTo-SecureString "thePass" -AsPlainText -Force) -Organization "theTenant.onmicrosoft.com"

returns OperationStopped: UnAuthorized

After some searches, it seems I need the Exchange.ManageAsApp API scope permission but I can't find it in Entra ID lists in Authorized API.

By the way : the command Connect-ExchangeOnline -Device works like a charm but need interaction and I try to automate Distribution Group creation (and the Graph API can't do that).

Thanks for your help.

Exchange Online
Exchange Online

A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.

0 comments No comments

Answer accepted by question author
Austin-H 8,370 Reputation points Microsoft External Staff Moderator
2025-11-29T16:49:52.49+00:00

Hello Lucien | MasterIT
Thank you for posting question to Microsoft Q&A Forum.

Please check on this article: https://learn.microsoft.com/en-us/services-hub/microsoft-engage-center/health/pdfs/getting-started-office365exchange/app-auth
On my environment I could find Exchange.ManageAsApp like this screenshot:
User's image

Please let me know if you could find this option from your end.

I am looking forward to your reply.


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.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Lucien | MasterIT 20 Reputation points
    2025-11-29T17:04:05.91+00:00

    Thanks @Austin-H , Fast and Good !

    I'm a bit ashamed, I search with "Exchange" in the search bar and it returns nothing.

    Works for me. New error though :

    OperationStopped: The role assigned to application xxxxxxxxxxxxx-xxxxxxxxxxx-xxxx isn't supported in this scenario. Please check online documentation for assigning correct Directory Roles to
    Azure AD Application for EXO App-Only Authentication.
    

    Any ideas ?

    (I mark the thread as resolved)

    Thanks again

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.