powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Cannot call "Set-PnPSiteVersionPolicy" API with an app-only principal.

Open kavuriss-nih opened this issue 8 months ago • 0 comments

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

Image

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?

  • [X ] Windows
  • [ ] Linux
  • [ ] MacOS
  • [ ] Azure Cloud Shell
  • [ ] Azure Functions
  • [ ] Other : please specify

kavuriss-nih avatar Apr 04 '25 19:04 kavuriss-nih