r/sharepoint • • 7d ago

SharePoint Online Fixing incorrectly synced permissions during migration from AD

Did a migration from a server to SharePoint using the migration tool which carried over permissions as they are entra synced.

However looks like one user was incorrectly entra synced and wasn’t hard matched to her cloud email address which therefore meant it created a wrong one. Name4657@domain.com

The wrong synced account was the account it gave all the permissions to. I have since fixed this entra sync issue however she is missing access to any files/folders that have unique synced permissions which is a tonne.

It’s a 750gb SharePoint site with over 500k files.

Is there anyway I can automate replacing the permissions with the wrong account, with the newly synced correct account, giving it access to everything the wrong account has.

1 Upvotes

1 comment sorted by

3

u/temporaldoom Dev 6d ago edited 6d ago

Do you not have a log output from whatever migrated it?

If you don't then I imagine the only real way would be to use pnp powershell to retrieve the file list and then check if it has unique permissions and if the user is in the list , apply the new user to the permissions of the object.

The commands off the top of my head would be

get-pnplistitem

get-pnpproperty

Set-PnPListItemPermission

https://www.sharepointdiary.com/ has example scripts for pretty much any scenario. I suggest you familiarise yourself with their site.

Going forward I would also look at flattening your data structure into separate sites/document libraries, rather than relying on Entra Permissions, it gives power back to Site/Data Owners to grant access to their data rather than relying on IT.