I lied, not just Teams, also Sharepoint and Onedrive!
This TeamPermissions PowerShell module will retrieve all specific / unique permissions granted to any type of identity (group, external, internal, sharing link etc). It will then generate a full report in XLSX, CSV or HTML format that contains ALL unique permissions for a given Team, Sharepoint site or Onedrive location for all files, folders, lists, list items etc. Example:
It uses the safe Entra Delegated Permission Flow for authentication so your credentials/tokens stay with you, but this does mean you have to run it as a Sharepoint Administrator (or Global Admin), there is no support for MI/SPN runs yet but can be added easily if there is much demand.
Since it exports to Excel in append mode, you could run it for multiple (or all) team sites and use e.g. Pivots to view all permissions for a given user.
Do note that although some work has been done on performance, it does not scan multiple locations in parallel yet, this will be added in a future version.
Install-PSResource -Name TeamPermissions -Repository PSGallery
#then get xlsx/html reports for the INT-Finance Department Team:
Get-TeamPermissions -teamName "INT-Finance Department" -ExpandGroups -OutputFormat XLSX,HTML
#Or get all permission for a Sharepoint site:
Get-TeamPermissions -TeamSiteUrl "https://tenant.sharepoint.com/sites/site" -ExpandGroups -OutputFormat Default
Notes
Required PS modules: PnP.PowerShell, ImportExcel
Running multiple times will append data if you don’t move the (xlsx, csv, html) file, turning the report into a multi-location report.
Auto detection of subsites and linked channels (e.g. private channels, which have their own sharepoint site)