pnp / PnP-PowerShell

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

[BUG] Get-PnPApp only works with -UseAdfs connection after you use -UseWebLogin #2890

Open MHector1 opened 3 years ago

MHector1 commented 3 years ago

Calling Get-PnPApp (or other ALM cmdlets) with a connection opened with the switch -UseAdfs or no switch (Windows claims) does not work. The connection opens correctly and other PnP cmdlets work fine, but the ALM cmdlets do not work. They either give an Access denied error or a 403 Forbidden error.

If you open a connection with the same user account first, using -UseWebLogin, the Get-PnPApp and other ALM calls succeed. Then if you open a new connection with -UseAdfs, the ALM cmdlets also succeed unless/until you clear the internet cache for that user account in Windows (or presumably a cookie expires or other persistent artifact from the web login approach).

This is SharePoint 2019 on-premises. Both the PnP 2019 and the PnP for SPO were tried, just to see if they would behave differently. They behave the same.

Expected behavior

Id Title Deployed AppCatalogVersion InstalledVersion


8461426d-f104-4f47-84b5-17529d118d83 SomeApp1 True 1.1.3.0
44ad6c9b-f519-4d8a-899b-31654c24ba18 AnotherApp2 True 1.0.0.12
db669690-32fb-4f18-9edc-1432fb70767a YetAnotherApp3 True 1.0.1.12

Actual behavior

Get-PnpApp : {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

Steps to reproduce behavior

$conn = Connect-PnPOnline -Url "https://xxxx.yyy.org/sites/appcatalog" -UseAdfs; Get-PnPApp -Connection $conn -Scope Tenant; Disconnect-PnPOnline -Connection $conn;

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

Yes - [ ] PnP PowerShell for SharePoint 2019 Yes - [ ] PnP PowerShell for SharePoint Online

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

3.8.1904.0 - PnP PowerShell for SharePoint 2019 3.24.2008.1 - PnP PowerShell for SharePoint Online

How did you install the PnP-PowerShell Cmdlets?

1 - [ ] Installed through the PowerShell Gallery with Install-Module (PnP PowerShell for SharePoint 2019) 2 - [ ] Other means - cloned and forked the PnP source from GitHub (PnP PowerShell for SharePoint Online)

MHector1 commented 3 years ago

@erwinvanhunen , @KoenZomers - Hi, should this be posted somewhere else? Please let me know.