Change Connect-PNPOnline User

%3CLINGO-SUB%20id%3D%22lingo-sub-666010%22%20slang%3D%22en-US%22%3EChange%20Connect-PNPOnline%20User%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-666010%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20use%20Connect-PNPOnline%20-UseWebLogin%20successfully%20but%20I%20cannot%20figure%20out%20how%20to%20change%20the%20user.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20logged%20with%20my%20normal%20account%20successfully%20but%20now%20when%20I%20want%20to%20login%20with%20my%20admin%20account%20it%20seems%20to%20have%20cached%20my%20normal%20user%20account.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20can%20I%20switch%20users%3F%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI've%20tried%3C%2FP%3E%3CP%3EDisconnect-PNPOnline%3C%2FP%3E%3CP%3EI've%20tried%20opening%20a%20new%20PS%20window%3C%2FP%3E%3CP%3EI've%20tried%20using%20the%20-SPOManagementShell%20switch%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-666010%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-738995%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20Connect-PNPOnline%20User%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-738995%22%20slang%3D%22en-US%22%3EI'm%20also%20interested%20because%20i'm%20facing%20the%20same%20problem%3CBR%20%2F%3E%3CBR%20%2F%3EDid%20you%20find%20a%20solution%20%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-739350%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20Connect-PNPOnline%20User%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-739350%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234448%22%20target%3D%22_blank%22%3E%40Frederick%20Wilson%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHave%20you%20tried%20the%26nbsp%3B%3CSTRONG%3E-Credentials%20(Get-Credential)%3C%2FSTRONG%3E%20parameter%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3EConnect-PnPOnline%20-Url%20%3CA%20href%3D%22https%3A%2F%2Fcontoso.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcontoso.sharepoint.com%3C%2FA%3E%20-Credentials%20(Get-Credential)%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3EI%20hope%20this%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENorm%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-739948%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20Connect-PNPOnline%20User%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-739948%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F111382%22%20target%3D%22_blank%22%3E%40Norman%20Young%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234448%22%20target%3D%22_blank%22%3E%40Frederick%20Wilson%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20needed%20to%20use%20a%20web%20login%20because%20of%20MFA.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I%20found%20a%20solution%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EConnect-PnPOnline%20-Url%20%22%3CA%20href%3D%22https%3A%2F%2Fxxxxxxx.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fxxxxxxx.sharepoint.com%3C%2FA%3E%22%20-SPOManagementShell%20-ClearTokenCache%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-740020%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20Connect-PNPOnline%20User%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-740020%22%20slang%3D%22en-US%22%3EI've%20tried%20the%20clear%20token%20option%20but%20it%20doesn't%20ask%20for%20a%20different%20login.%20It%20would%20be%20nice%20if%20there%20was%20a%20switch%20to%20enforce%20request%20login%20information.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-740219%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20Connect-PNPOnline%20User%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-740219%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234448%22%20target%3D%22_blank%22%3E%40Frederick%20Wilson%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20works%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3EConnect-PnPOnline%20-SPOManagementShell%20-Url%20%3CA%20href%3D%22https%3A%2F%2Fcontoso-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcontoso-admin.sharepoint.com%3C%2FA%3E%20-ClearTokenCache%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122380i74E67259A93CD2F3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Untitled.png%22%20title%3D%22Untitled.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-752106%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20Connect-PNPOnline%20User%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-752106%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F111382%22%20target%3D%22_blank%22%3E%40Norman%20Young%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20try%20this.%20Thank%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHopefully%20it%20lets%20me%20switch%20accounts%20when%20I%20try%20to%20log%20back%20in.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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
Highlighted
I'm also interested because i'm facing the same problem

Did you find a solution ?
Highlighted

@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

Highlighted

@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

 

Highlighted
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.

Highlighted

@Frederick Wilson,

 

This works:

 

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

Untitled.png

Highlighted

@Norman Young,

 

I will try this. Thank you.

 

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