You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working on some automated deployment scripts that take advantage of the PnP PowerShell Module. Sometimes, when running deployment scripts, 3rd parties report a 403 error. When then occurs, I assume that they entered a correct login and password, but they likely got accessed denied.
How can I get the login of the user that was attempting to access the site via the Connect-PnPOnline? Things I tried:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been working on some automated deployment scripts that take advantage of the PnP PowerShell Module. Sometimes, when running deployment scripts, 3rd parties report a 403 error. When then occurs, I assume that they entered a correct login and password, but they likely got accessed denied.
How can I get the login of the user that was attempting to access the site via the Connect-PnPOnline? Things I tried:
(Get-PnPConnection | select -ExpandProperty pscredential).username
Unfortunately, it does not contain the user login when using modern authentication and MFA.
Get-PnPContext
This code will fail if the user does not have enough permissions. The code will fail with a 403 error
Invoke-PnPSPRestMethod -Url "$TARGET_SITE_URL/_api/web/currentUser"
Same issue as above.
Question
Is there a way to figure out what account is used for Connect-PnPOnline commandlet?
Beta Was this translation helpful? Give feedback.
All reactions