Change Connect-PNPOnline User

Brass Contributor

I am use Connect-PNPOnline -UseWebLogin successfully but I cannot figure out how to change the user.

 

I have logged with my normal account successfully but now when I want to login with my admin account it seems to have cached my normal user account.

 

How can I switch users?


I've tried

Disconnect-PNPOnline

I've tried opening a new PS window

I've tried using the -SPOManagementShell switch

6 Replies
I'm also interested because i'm facing the same problem

Did you find a solution ?

@Frederick Wilson,

 

Have you tried the -Credentials (Get-Credential) parameter?

 

Connect-PnPOnline -Url https://contoso.sharepoint.com -Credentials (Get-Credential)

I hope this helps.

 

Norm

@Norman Young @Frederick Wilson 

 

I needed to use a web login because of MFA.

 

But I found a solution :

 

Connect-PnPOnline -Url "https://xxxxxxx.sharepoint.com" -SPOManagementShell -ClearTokenCache

 

I've tried the clear token option but it doesn't ask for a different login. It would be nice if there was a switch to enforce request login information.

@Frederick Wilson,

 

This works:

 

Connect-PnPOnline -SPOManagementShell -Url https://contoso-admin.sharepoint.com -ClearTokenCache

Untitled.png

@Norman Young,

 

I will try this. Thank you.

 

Hopefully it lets me switch accounts when I try to log back in.