pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions
https://pnp.github.io/pnpframework/
MIT License
204 stars 141 forks source link

[BUG] Add-PnPApp Fails with access denied when connected using a global tenant administrator account (on Windows) #52

Closed reidav closed 3 years ago

reidav commented 3 years ago

Reporting an Issue

Add-PnPApp fails with access denied when connected using a tenant global administrator account.

Expected behavior

App should be uploaded into the tenant site app catalog

Actual behavior

pnpissue pnpissue1

Steps to reproduce behavior

Connect-PnPOnline -Url 'siteUrl' -Credentials 'credentials' Add-PnPApp -Path 'appPath'

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

0.3.7 (Nightly) + Pswh 7.1.0

Which operating system/environment are you running PnP PowerShell on?

reidav commented 3 years ago

I'm still trying to investigate on it, if you have a quick tip to monitor outgoing traffic using dotnet core on windows.. I'm still not able to track the request, even using Fiddler everywhere or Fiddler classic as mentioned by @veronicageek. It works only with legacy PnP PowerShell for now. I'll test using Linux also.

reidav commented 3 years ago

Just tried on archlinux, using 0.3.7 (Nightly) + Pswh 7.1.0, same tenant, same user, it works, app package is uploaded.

reidav commented 3 years ago

This issue is related to pnpframework, my apologies for tracking it here ;

@erwinvanhunen May I kindly ask you to transfer it to pnpframework repos please ? Thx

erwinvanhunen commented 3 years ago

@reidav regarding monitoring on Windows: I use Fiddler. I found out that the order of Launching is important. Launch Fiddler first, then launch PowerShell core. It's important to do it in that order.

erwinvanhunen commented 3 years ago

There is indeed a logic issue with retrieving the request digest retrieval. I will move this issue to the PnP Framework repo and take it from there. I already am working on a fix.

reidav commented 3 years ago

@reidav regarding monitoring on Windows: I use Fiddler. I found out that the order of Launching is important. Launch Fiddler first, then launch PowerShell core. It's important to do it in that order.

You made my day ! I've been through lots of details to get a trace ($env:http_proxy, wireshark sslkeylog and many more ..) Respecting the start order is really a key for success :) Thanks !

erwinvanhunen commented 3 years ago

We just merged a fix for this issue which will be available in the nightly release of tomorrow in both the PnP Framework and PnP PowerShell.