The following article shows how to find out what role is needed to run a specific cmdlet in either on-premises or Exchange Online.
On-Prem
This example lists out all the RBAC roles that have the ability to run the New-Mailbox cmdlet.
$Cmdlet = 'New-Mailbox' Get-ManagementRole -Cmdlet $Cmdlet | Get-ManagementRoleAssignment | Sort-Object -Unique RoleAssigneeName | select RoleAssigneeName
Azure Cloud
The next two examples discover the same scenario that the on-prem example did, only in Azure.
$Cmdlet = 'New-Mailbox' Get-ManagementRoleEntry -Identity "*\$Cmdlet" | Foreach {Get-ManagementRoleAssignment -Role $_.Role} | Sort-Object -Unique RoleAssigneeName | Select-Object RoleAssigneeName
Or
$Cmdlet = 'New-Mailbox' Get-ManagementRole -Cmdlet $Cmdlet | Foreach {Get-ManagementRoleAssignment -Role $_.Name} | Sort-Object -Unique RoleAssigneeName | Select-Object RoleAssigneeName
Comments