exchange online powershell get mailbox permissions

Master Exchange Online PowerShell: Get Mailbox Permissions Fast

By John Harris
AD

Managing permissions in Exchange Online requires a precise understanding of how access controls are implemented and audited. The Exchange Online PowerShell module provides a direct interface to these configurations, allowing administrators to view and modify mailbox permissions with granular control. One of the most critical cmdlets for security management is the Get-MailboxPermission command, which reveals the explicit and inherited rights assigned to users and service accounts. This deep dive into mailbox access helps security teams identify potential vulnerabilities or misconfigurations that could lead to unauthorized data exposure.

Understanding Mailbox Permission Types

Before executing specific queries, it is essential to distinguish between the different layers of permissions within Exchange Online. There are two primary categories: Mailbox Permissions and Folder Permissions. Mailbox Permissions apply to the entire mailbox database object, governing overarching actions like full access or send-as rights. In contrast, Folder Permissions are tied to specific sub-folders such as Calendar, Tasks, or Inbox, controlling actions like read-only access or availability of items. The Get-MailboxPermission cmdlet specifically targets the former, providing a high-level view of who has direct access to the mailbox itself.

Basic Syntax and Common Parameters

The fundamental syntax for retrieving permissions is straightforward, relying on the identity of the target mailbox. The most common usage involves piping the results to Format-List to ensure readability of the returned objects. Below is the basic command structure used to query a single user.

AD
Manage Send As Permissions using PowerShell
Manage Send As Permissions using PowerShell
an orange car driving down a street next to a bridge
an orange car driving down a street next to a bridge
Kurzanleitung für die Börse | Online-Börse | Mischling | Nachrichtenfluss | IT 2013 | SysAdm
Kurzanleitung für die Börse | Online-Börse | Mischling | Nachrichtenfluss | IT 2013 | SysAdm

Example: Querying a Single Mailbox

Get-MailboxPermission -Identity "j.smith@companydomain.com" | Format-List User, AccessRights, IsInherited, Deny

This command returns a list of users or groups that have explicit permissions on the mailbox for "j.smith." The output details the specific access level (such as FullAccess or SendAs), whether the permission is inherited from a parent container, and if the access is denied.

Interpreting the Results: User, AccessRights, and IsInherited

Understanding the columns in the output is vital for accurate auditing. The User column identifies the trustee, which is often a user account, a security group, or a legacy mailbox. The AccessRights column specifies the level of control, ranging from ReadPermission to Owner. The IsInherited boolean indicates if the permission was directly applied or propagated down from a parent scope, such as a "Domain Users" group. This distinction is crucial for cleaning up legacy or unwanted access rights.

an image of a bridge with words describing the different types of bridges and how they are connected
an image of a bridge with words describing the different types of bridges and how they are connected
Mail App Error 0x8500201d: How to Fix it
Mail App Error 0x8500201d: How to Fix it
Adding Calendar Permissions in Microsoft 365 and Exchange with PowerShell
Adding Calendar Permissions in Microsoft 365 and Exchange with PowerShell

Advanced Filtering and Managing Access

For large environments, filtering the results is necessary to isolate specific security risks. Administrators can utilize the -User parameter to check what permissions a specific account holds across multiple mailboxes, or use wildcard searches to audit entire departments. Furthermore, this cmdlet is the logical precursor to the Add-MailboxPermission and Remove-MailboxPermission cmdlets. When removing access, it is generally recommended to target the specific user rather than breaking inheritance for the entire group to maintain security integrity for other users.

Filtering for External Users

Get-MailboxPermission -Identity "Marketing Department" | Where-Object { $_.User -like "*\EXT*" }

Exchange Online assigns external sharing permissions with a specific identifier containing "EXT." This command helps administrators quickly identify which mailboxes have shared resources with partners or third-party organizations, ensuring compliance with data loss prevention policies.

AD

Common Security Scenarios and Best Practices

Security audits often focus on two high-risk scenarios: privileged accounts and dormant mailboxes. Application impersonation roles used by third-party apps often require Full Access to mailboxes, but these assignments can become outdated. Similarly, departing employees' direct permissions must be revoked immediately to prevent data exfiltration. Using Get-Mailbox in conjunction with Get-MailboxPermission allows for the automated review of permissions for mailboxes that have not logged in for over 90 days, streamlining the offboarding process.

How to Purge or Delete a Disconnected Mailbox in Exchange 2007 - geekyprojects.com
How to Purge or Delete a Disconnected Mailbox in Exchange 2007 - geekyprojects.com
How to Set Up Email Notifications for Your Windows Home Server
How to Set Up Email Notifications for Your Windows Home Server
Change Where Sent Items Go in Outlook - Quick & Simple Guide
Change Where Sent Items Go in Outlook - Quick & Simple Guide
website: temp-mail.org
website: temp-mail.org
9 ways to open PowerShell in Windows (including as administrator)
9 ways to open PowerShell in Windows (including as administrator)
Microsoft says transport/DLP rule conflicts have forced it to pull Exchange Server update
Microsoft says transport/DLP rule conflicts have forced it to pull Exchange Server update

Troubleshooting and Performance Considerations

When running these commands across a hybrid environment, administrators might encounter throttling limits imposed by Exchange Online. To mitigate performance hits, it is advisable to run bulk queries during off-peak hours or utilize the -ResultSize parameter to limit the dataset. If the results return stale data, ensure that the Exchange Online PowerShell module is updated to the latest version. Occasionally, permissions assigned via Azure AD roles might not display as expected in the AccessRights list; in these instances, verifying the role assignments in the Azure portal is the next logical troubleshooting step.

Archiving emails in Outlook: Here's what you need to know
Archiving emails in Outlook: Here's what you need to know
9 Top Virtual Mailbox Providers
9 Top Virtual Mailbox Providers
Email Provider Mailbox.org launches one-time passwords and custom domain support - gHacks Tech News
Email Provider Mailbox.org launches one-time passwords and custom domain support - gHacks Tech News
How to Use Rules to Manage Your Outlook.com Email
How to Use Rules to Manage Your Outlook.com Email
Restore IMAP emails with accurate results: Mail backup X
Restore IMAP emails with accurate results: Mail backup X
5 Things to Do When Your Outlook Mailbox Is Full
5 Things to Do When Your Outlook Mailbox Is Full
VPN service "OkayFreedom" that can hide its own IP address · connection source for free
VPN service "OkayFreedom" that can hide its own IP address · connection source for free
Virtual Mailbox Basics: How I Get Mail While I Travel Full-Time...
Virtual Mailbox Basics: How I Get Mail While I Travel Full-Time...
What Is a Virtual Mailbox? (And Why You Should Get One)
What Is a Virtual Mailbox? (And Why You Should Get One)
How to Restart Outlook on Windows
How to Restart Outlook on Windows
The 5 Most Secure and Encrypted Email Providers
The 5 Most Secure and Encrypted Email Providers
Free Email on Own Domain with 50 Accounts: Lark Mail
Free Email on Own Domain with 50 Accounts: Lark Mail
Manage Your Microsoft Outlook Email Inbox Like a Boss
Manage Your Microsoft Outlook Email Inbox Like a Boss
How (and Why) to Use DuckDuckGo's @Duck.com Email Protection
How (and Why) to Use DuckDuckGo's @Duck.com Email Protection
AD