SOLVED

Connecting to PnPOnline - Not prompted to login

%3CLINGO-SUB%20id%3D%22lingo-sub-131523%22%20slang%3D%22en-US%22%3EConnecting%20to%20PnPOnline%20-%20Not%20prompted%20to%20login%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-131523%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20script%20with%20%3CSPAN%3EConnect-PnPOnline%3C%2FSPAN%3E%3CSPAN%3E%24%3C%2FSPAN%3E%3CSPAN%3EtenantUrl%3C%2FSPAN%3E%3CSPAN%3E-%3C%2FSPAN%3E%3CSPAN%3EUseWebLogin%3C%2FSPAN%3Eand%20when%20I%20ran%20it%20this%20morning%2C%20I%20was%20not%20prompted%20to%20login%20to%20the%20tenant.%20I%20had%20not%20accessed%20the%20tenant%20for%20over%205%20days%20using%20powershell.%20I%20had%20logged%20in%20using%20Chrome%20earlier%20today.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWould%20the%20PnP%20cmdlet%20be%20using%20those%20credentials%3F%3C%2FP%3E%0A%3CP%3Eis%20this%20expected%20behavior%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F122%22%20target%3D%22_blank%22%3E%40Erwin%20van%20Hunen%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-131523%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-131531%22%20slang%3D%22en-US%22%3ERe%3A%20Connecting%20to%20PnPOnline%20-%20Not%20prompted%20to%20login%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-131531%22%20slang%3D%22en-US%22%3EThe%20last%20time%20you%20logged%20in%20with%20-UseWebLogin%2C%20did%20you%20by%20any%20chance%20answer%20yes%20to%20the%20question%20'Stay%20signed%20in%3F'%20If%20so%2C%20yes%2C%20that%20is%20expected.%20It's%20not%20PnP%20PowerShell%20controlling%20that%2C%20it's%20the%20combination%20of%20browser%20and%20cookies%20(that's%20effectively%20what%20UseWebLogin%20is%20doing%3A%20it's%20using%20an%20embedded%20browser)%3C%2FLINGO-BODY%3E
Respected Contributor

I have a script with Connect-PnPOnline $tenantUrl -UseWebLogin and when I ran it this morning, I was not prompted to login to the tenant. I had not accessed the tenant for over 5 days using powershell. I had logged in using Chrome earlier today. 

Would the PnP cmdlet be using those credentials?

is this expected behavior?

 

@Erwin van Hunen

 

1 Reply
best response confirmed by Dean Gross (Respected Contributor)
Solution
The last time you logged in with -UseWebLogin, did you by any chance answer yes to the question 'Stay signed in?' If so, yes, that is expected. It's not PnP PowerShell controlling that, it's the combination of browser and cookies (that's effectively what UseWebLogin is doing: it's using an embedded browser)