Skip to content

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

Open
@kavuriss-nih

Description

@kavuriss-nih

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions