pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
985 stars 665 forks source link

Set-PnPSite command reporting (401) Unauthorized Error, in environment where legacy authentication is blocked #3043

Open Hideo-doi opened 3 years ago

Hideo-doi commented 3 years ago

Reporting an Issue or Missing Feature

■ Problem After connecting to Sharepoint with Connect-PnPOnline, the following error occurs when executing Set-PnPSite

PS C: \ work> Connect-PnPOnline https://testtenant.sharepoint.com/sites/template_test -Credentials $ cred PS C: \ work> Get-PnPSite

Url Compatibility Level


https://testtenant.sharepoint.com/sites/template_test 15

PS C: \ work> PS C: \ work> PS C: \ work> Get-PnPSite

Url Compatibility Level


https://testtenant.sharepoint.com/sites/template_test 15

PS C: \ work> Set-PnPSite -Sharing ExistingExternalUserSharingOnly Set-PnPSite: The remote server returned an error: (401) Unauthorized. "Error.

  • Set-PnPSite -Sharing ExistingExternalUserSharingOnly
  • CategoryInfo: WriteError: (:) [Set-PnPSite], WebException
  • FullyQualifiedErrorId: EXCEPTION, PnP.PowerShell.Commands.Site.SetSite

■ Background

■ Others

 → Does the Set-PnPSite command need to allow legacy authentication?

Expected behavior

Set-PnPSite -Sharing ExistingExternalUserSharingOnly Set-PnPSite -NoScriptSite $ true Set-PnPSite -DisableSharingForNonOwners`

Actual behavior

Only Set-PnPSite gives an error that is not allowed

Steps to reproduce behavior

$ cred = credential Connect-PnPOnline https://testtenant.sharepoint.com/sites/test -Credentials $ cred Set-PnPSite -Sharing ExistingExternalUserSharingOnly

============== Set-PnPSite: The remote server returned an error: (401) Unauthorized. "Error.

Which version of the PnP-PowerShell Cmdlets are you using?

-[] PnP PowerShell for SharePoint 2013 -[] PnP PowerShell for SharePoint 2016 -[] PnP PowerShell for SharePoint 2019 -[○] PnP PowerShell for SharePoint Online

What is the version of the Cmdlet module you are running?

Version: 3.25.2009.0

How did you install the PnP-PowerShell Cmdlets?

-[] MSI Installed downloaded from GitHub -[○] Installed through the PowerShell Gallery with Install-Module -[] Other means

ghost commented 3 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Hideo-doi commented 3 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

When do you triage about this issue.