I am encountering an error running Set-PnPListPermission from an Azure Automation runbook which is "The list is not DocumentLibrary, VersionPolicies is not supported."
The error is accurate, this is a SharePoint list and not a Document Library however the cmdlet should still run fine and does in fact run fine when I run it manually from PowerShell 7.
I have simplified the code down to the following:
Connect-PnPOnline -ManagedIdentity -Url $myURL
$myList = Get-PnPList -Identity "My List"
Set-PnPList -Identity "My List" -BreakRoleInheritance
Set-PnPListPermission -Identity "My List" -Group "Admin Group" -AddRole "Full Control"
FWIW, this was part of a much larger script and all the other SharePointPnP cmdlets run fine including this same cmdlet on Document Libraries
Things I've tried:
- I've made sure the runbook and my PowerShell are both running the same nightly build (as well as tried a few other versions)
- I've tried multiple methods of calling Connect-PnPOnline including using a ManagedIdentity for auth as well as passing regular credentials
- I've stripped away all the variables and used hard-coded values (thought maybe there was something going on with the variable interpolation)
- I've combed through Google, Bing and many sites but am having trouble even finding this exact error anywhere
- Double-checked and versioning IS turned on for the list
Any help or thoughts on what to try next would be greatly appreciated.