Office 365 Powershell – Configure Permissions

Microsoft’s Office 365 is basically Exchange 2016 through a web-page. A lot of the buttons you used to have are now hidden, and can only be access through Powershell.

This post contains raw Powershell code to connect in to your Office 365 instance, and change user permissions over individual parts of mailboxes — either the entire thing, or just a calendar, contacts, or email.

#Define the Office 365 Admin Account credentials. Use an Office 365 admin account (user@onmicrosoft.domain.com/password)
$LiveCred = Get-Credential

#Define the Office 365 Powershell server you are connecting to and which credentials to use
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

#Connect / Dial-In to Office 365 Powershell
Import-PSSession $Session



#Ways to check permissions. If you want to assign, just switch out the "Get" at the start to "Add" for new permissions, or "Set" for changing existing permissions.
#For Calendar
Get-MailboxFolderPermission -Identity user1@domain.com:\calendar
#For Mail
Get-MailboxFolderPermission -identity user1@domain.com:\inbox
#For contacts
Get-MailboxFolderPermission -identity user1@domain.com:\contacts
#For the entire account
Get-MailboxFolderPermission -identity user1@domain.com

#If the user is yet added
Add-MailboxFolderPermission -Identity user123@domain.com:\calendar -user userABC@domain.com -AccessRights Owner

#If the user needs full control
Set-MailboxFolderPermission -Identity user123@domain.com:\calendar -user userA@domain.com -AccessRights Owner
Set-MailboxFolderPermission -Identity user123@domain.com:\calendar -user userB@domain.com -AccessRights Owner
Set-MailboxFolderPermission -Identity user123@domain.com:\calendar -user userC@domain.com -AccessRights Owner
Set-MailboxFolderPermission -Identity user123@domain.com:\calendar -user userD@domain.com -AccessRights Owner
Set-MailboxFolderPermission -Identity user123@domain.com:\calendar -user userE@domain.com -AccessRights Owner

#AccessRights Types
Owner (Full Permissions)
Delegate (Owner, but cannot see private)
PublishingEditor (Read/Write/Modify/New)
Editor (Read/Write/Modify)
Reviewer (Read Only)
Contributor (Write Only)

#Reference
https://technet.microsoft.com/en-us/library/dd298062(v=exchg.160).aspx

 

Leave a Reply

Your email address will not be published. Required fields are marked *