“I know that Power Automate has an action to break permissions on a file in SharePoint, but how can I reverse it to restore the permission inheritance?”
There’re two standard actions in Power Automate to manage permissions within SharePoint. One is the ‘Stop sharing an item or a file’ that will break permissions inheritance and remove almost all permissions. The second one is the ‘Grant access to an item or a folder’ action to assign specific permissions. Using these actions you can easily manage permission without HTTP requests as already explained.
But there’s another operation that doesn’t have its own action: restoring permissions inheritance. Once there’s no more reason to keep permissions unique, you should always restore their inheritance. One reason is that unique permissions are terrible to manage. The other is that SharePoint has a limit of 50.000 unique permissions, you can’t keep unique permissions for everything.
Restore the permissions inheritance with an HTTP request
Since there’s no direct action to restore the permissions, you must go back to HTTP requests. You’ll need a reverse HTTP request to the one breaking the role inheritance. Instead of BreakRoleInheritance() it must be ResetRoleInheritance().
_api/Web/lists/getByTitle('<list name>')/items(<item id>)/ResetRoleInheritance()
Note: < … > are placeholders, replace them including the < and >.
Such HTTP request will remove all unique permissions from the item and restore the permissions inheritance. It can be used on a SharePoint item, document, or a whole list or a library (if you skip the items() part).
As many times before, if Power Automate doesn’t give you an action to restore SharePoint permissions directly, you must use an HTTP request. It’s a simple request where all you need is the site address, name of the list/library, and id of the item/file. It’ll remove all unique permissions and reset them back to the parent permissions – let it be a folder, a list or a library.
And if you’re not sure which files/folders have unique permissions, you can list them using another HTTP request.