[BUG] Cannot call "Set-PnPSiteVersionPolicy" API with an app-only principal. #5206
Replies: 3 comments
-
|
@kavuriss-nih : Please test with the latest nightly build. A similar issue (#5105 ) couldn’t be reproduced on my side. |
Beta Was this translation helpful? Give feedback.
-
|
I am moving this ticket to discussion as it seems to be a limitation with MS backend API which does not allows the app only principal. |
Beta Was this translation helpful? Give feedback.
-
|
@reshmee011 - I'm running version 3.1.0. I'm seeing the same error, but the
|
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Reporting an Issue or Missing Feature
we are unable to call the "Set-PnPSiteVersionPolicy" using the service principal. But we are able to call the Get-PnPSiteVersionPolicy using the service principal.
Expected behavior
Able to set the Site Version Policy using the Service Principal
Actual behavior
Steps to reproduce behavior
Please include complete script or code samples in-line or linked from gists
Import-Module "C:\Program Files\WindowsPowerShell\Modules\PnP.PowerShell\2.99.177\Pnp.PowerShell.psd1" -Force -DisableNameChecking
$siteUrl = ""
$clientId = ""
$thumbprint = "****************"
$tenant = ""
Connect-PnPOnline -Url $siteUrl -ClientId $clientId -Thumbprint $thumbprint -Tenant "$tenant.onmicrosoft.com" -ValidateConnection
Get the versioning policy of the site
Get-PnPSiteVersionPolicy
Set-PnPSiteVersionPolicy -EnableAutoExpirationVersionTrim $false -MajorVersions 300 -MajorWithMinorVersions 20 -ExpireVersionsAfterDays 0
What is the version of the Cmdlet module you are running?
(you can retrieve this by executing
Get-Module -Name "PnP.PowerShell" -ListAvailable)2.99.177 nightly PnP.PowerShell
Which operating system/environment are you running PnP PowerShell on?
Beta Was this translation helpful? Give feedback.
All reactions