Use Imap.Accessasapp

Shah Mita (YIANA) 0 Reputation points
2025-03-31T10:18:49.8366667+00:00

Once you grant the permission to "Imap.Accessasapp' , the service principal can access to all the mailboxes of tenant ?

I am following the steps: - "Use client credentials grant flow to authenticate SMTP, IMAP, and POP connections"

https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth

Microsoft 365 and Office | Development | Microsoft 365 App Publishing
{count} votes

1 answer

Sort by: Most helpful
  1. Vasil Michev 119.7K Reputation points MVP Volunteer Moderator
    2025-04-01T08:11:47.96+00:00

    Yes, the Imap.Accessasapp application permission allows the service principal to access each and every mailbox within the tenant. By default, application permissions are unscoped, i.e. they cover all available resources. In contrast, delegate permissions are limited in scope - they only cover what the logged in user has access to.

    If you want to restrict the scope of Imap.Accessasapp or similar permissions, use the RBAC for applications functionality: https://learn.microsoft.com/en-us/exchange/permissions-exo/application-rbac

    That's the theory at least, as I haven't tested the IMAP scenario (and there is suspicious lack of mention for anything IMAP-related in the documentation above). I've pinged the PM on this just in case, will let you know if my answer above needs to be corrected.


Your answer

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