O365 - Export SharePoint Online Permissions


I've been looking into a way to document SharePoint permissions. There’s a few of ways, for example this script on the TechNet gallery but requires the installation of SharePoint Online PnP Module from github.

A better tool which is hosted on codeplex is SharePoint Permission Analyzer, this will give you a report of the permissions for each site and is very comprehensive. Here is a screenshot from a report of my tenant and you can enable file level reporting and save the files.



Also to be sure we can always dump permissions on a site level:

#Set-Execution Policy
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://domain-admin.sharepoint.com -credential $credential

#Get a list of sites
Get-SPOSite

#export the site permissions to a txt file (run for each require site
$site = “https://domain.sharepoint.com/sites/TestSite"
Get-SPOUser -Site $site | select * | Format-table -Wrap -AutoSize | Out-File E:\Temp\UsersReport.txt -Force -Width 360 -Append

$site = “https://domain.sharepoint.com/sites/RMSTestSite"
Get-SPOUser -Site $site | select * | Format-table -Wrap -AutoSize | Out-File E:\Temp\UsersReport.txt -Force -Width 360 -Append


This will produce the following:



Comments