SOLVED

Connect-PnPOnline -UseWebLogin fails, login window disappears

%3CLINGO-SUB%20id%3D%22lingo-sub-784915%22%20slang%3D%22en-US%22%3EConnect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-784915%22%20slang%3D%22en-US%22%3E%3CP%3EI%20downloaded%20the%20latest%20version%20of%26nbsp%3BPnP%20PowerShell%20today%20but%20have%20had%20no%20success%20with%26nbsp%3BConnect-PnPOnline%20(no%20problem%20using%26nbsp%3BConnect-SPOService).%20I%20get%20the%20dreaded%20error%20%22For%20security%20reasons%20DTD%20is%20prohibited%20in%20this%20XML%20document.%22%20I've%20researched%20this%20and%20tried%20all%20the%20fixes%2C%20like%20disabling%20IPv6%20and%20pointing%20to%20Google%20DNS%20servers.%20I've%20also%20tried%20Windows%20and%20Generic%20Credentials%2C%20but%20these%20don't%20avoid%20the%20online%20authentication%20and%20get%20the%20same%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20most%20promising%20work-around%20appeared%20to%20be%20the%26nbsp%3B-UseWebLogin%20option%2C%20but%20the%20window%20disappears.%20It's%20only%20up%20for%20a%20fraction%20of%20a%20second%2C%20which%20isn't%20long%20enough%20for%20me%20to%20read%20the%20single%20line%20of%20text%20there.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20anyone%20solve%20the%20case%20of%20the%20missing%26nbsp%3B-UseWebLogin%20window%3F%20This%20is%20an%20Office%20365%20E3%20tenant.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-784915%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785169%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785169%22%20slang%3D%22en-US%22%3EHave%20you%20tried%20amending%20your%20hosts%20file%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785558%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785558%22%20slang%3D%22en-US%22%3E%3CP%3EYou're%20a%20lifesaver%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F234199%22%20target%3D%22_blank%22%3E%40Steve%20Johnson%3C%2FA%3E.%20I%20saw%20that%20fix%20from%26nbsp%3BPaul%20Ryan%20online%2C%20but%20I%20neglected%20to%20try%20it.%20So%20in%20response%20to%20your%20post%2C%20I%20added%20this%20entry%20to%20my%20hosts%20file%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E127.0.0.1%20msoid.summitservices.us.com%20%23%20fix%20PnP%20connect%20problem%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ewhere%20our%20domain%20is%26nbsp%3Bsummitservices.us.com.%20I%20connected%20first%20time%20without%20an%20authentication%20dialog%20(since%20I'd%20already%20set%20up%20Windows%20Credentials).%20I%20ran%20a%20few%20other%20applets%20as%20a%20quick%20test%2C%20all%20successful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20definitely%20solved%20my%20main%20problem%2C%20but%20I%20tried%20to%20connect%20again%20using%20-UseWebLogin%20with%20the%20same%20result%3A%20quickly%20disappearing%20window.%20The%20mystery%20remains.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785571%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785571%22%20slang%3D%22en-US%22%3EHappy%20to%20help%20%3A)%3C%2Fimg%3E%3CBR%20%2F%3E%3CBR%20%2F%3EWhen%20-UseWebLogin%20quickly%20disappears%2C%20could%20it%20be%20you%20are%20already%20authenticated.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20run%20Get-PnPContext%20it%20should%20give%20you%20that%20info.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785606%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785606%22%20slang%3D%22en-US%22%3E%3CP%3ELooks%20like%20that's%20not%20exactly%20it%2C%20but%20there%20are%20more%20clues.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20opened%20a%20new%20PowerShell%20session%20and%20ran%26nbsp%3BGet-PnPContext%20just%20to%20make%20sure%20there%20was%20no%20connection%3B%20returned%20an%20error%20saying%20I%20needed%20a%20connection%20first.%20I%20ran%20connect%20again%20with%20the%20web%20option%2C%20and%20the%20window%20still%20disappears.%20However%2C%20this%20time%20I%20asked%20for%20the%20context%20again%20and%20I%20was%20authenticated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EApparently%2C%20something%20is%20bypassing%20a%20web%20dialog%20and%20trying%20a%20different%20authorization%20mechanism%2C%20which%20now%20succeeds%20because%20of%20the%20hosts%20configuration.%20To%20test%20this%2C%20I%20tried%20to%20connect%20to%20a%20different%20site%20that%20I%20hadn't%20configured%20with%20Credentials%20Manager%3B%20failed%20saying%20needed%20connection.%20Ran%20again%20with%20web%20option%2C%20window%20disappeared%2C%20but%20no%20error.%20Get-PnPContext%20then%20showed%20the%20new%20site.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInteresting%2C%20but%20still%20a%20little%20mystery%3F%20Isn't%26nbsp%3B-UseWebLogin%20supposed%20to%20bring%20up%20a%20dialog%20to%20enter%20username%20and%20password%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785619%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785619%22%20slang%3D%22en-US%22%3EIt%20is%2C%20but%20it%20sounds%20like%20it%20already%20has%20authentication%20credentials.%3CBR%20%2F%3E%3CBR%20%2F%3EDoes%20it%20still%20happen%20after%20clearing%20all%20web%20cache%2C%20cookies%20etc%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-785650%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-785650%22%20slang%3D%22en-US%22%3E%3CP%3EGood%20thoughts%2C%20haven't%20tried%20yet.%20Need%20to%20get%20some%20work%20done%20for%20a%20while.%20Will%20try%20later%20and%20let%20you%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-788002%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-788002%22%20slang%3D%22en-US%22%3E%3CP%3ESo%2C%20I%20may%20have%20taken%20a%20step%20backwards.%20After%20taking%20a%20break%20for%20a%20day%2C%20connecting%20no%20longer%20worked%20as%20smoothly%20as%20it%20did%20when%20I%20first%20modified%20the%20hosts%20file.%20I%20didn't%20change%20anything%20that%20I'm%20aware%20of%2C%20and%20I%20checked%20that%20hosts%20was%20the%20same.%20Long%20story%20short%2C%20I%20can%20connect%20but%20always%20have%20to%20add%20the%26nbsp%3B-UseWebLogin%20parameter.%26nbsp%3BGet-PnPConnection%20returns%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EConnectionType%20%3A%20O365%3CBR%20%2F%3EInitializationType%20%3A%20Unknown%3CBR%20%2F%3EMinimalHealthScore%20%3A%20-1%3CBR%20%2F%3ERetryCount%20%3A%2010%3CBR%20%2F%3ERetryWait%20%3A%201%3CBR%20%2F%3EPSCredential%20%3A%3CBR%20%2F%3ETelemetryClient%20%3A%20Microsoft.ApplicationInsights.TelemetryClient%3CBR%20%2F%3EUrl%20%3A%20%3CA%20href%3D%22https%3A%2F%2Fsummitservicesus.sharepoint.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsummitservicesus.sharepoint.com%2F%3C%2FA%3E%3CBR%20%2F%3ETenantAdminUrl%20%3A%3CBR%20%2F%3EContext%20%3A%20OfficeDevPnP.Core.PnPClientContext%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENote%20ConnectionType%20is%20O365%20and%20PSCredential%20is%20null.%20When%20it%20was%20working%20smoothly%2C%20my%20recollection%20is%20that%20PSCredential%20was%20populated%2C%20though%20I%20don't%20remember%20the%20specifics.%20Regardless%2C%20I%20haven't%20been%20denied%20permission%20yet%20on%20any%20cmdlets%20I've%20run%20(mostly%20gets).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFollowing%20your%20suggestion%2C%20I%20did%20try%20clearing%20cache%20first%20then%20cookies%20and%20history.%20There%20was%20no%20apparent%20difference%20in%20behavior.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-788441%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-788441%22%20slang%3D%22en-US%22%3EInteresting.%20Which%20version%20of%20the%20PnP%20cmdlets%20are%20you%20using%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-789340%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-789340%22%20slang%3D%22en-US%22%3E%3CP%3EJust%20downloaded%26nbsp%3B3.12.1908.1%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-789365%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-789365%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20I%20say%20just%2C%20I%20mean%20just%20a%20few%20days%20ago.%20This%20is%20my%20first%20foray%20into%20SP%20online%20applets.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-797062%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-797062%22%20slang%3D%22en-US%22%3EAre%20you%20still%20using%20the%20Google%20DNS%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-797247%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-797247%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20I%20confirmed%20all%20the%20setting%20changes%20I'd%20made%20trying%20to%20fix%20the%20original%20problem%20(e.g.%2C%20hosts%2C%20IPv6%2C%20Google%20DNS%2C%20Windows%20creds%2C%20etc.)%20are%20still%20in%20place.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2033381%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2033381%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F353385%22%20target%3D%22_blank%22%3E%40KenStewart%3C%2FA%3E%26nbsp%3Bdid%20you%20ever%20get%20this%20working%3F%26nbsp%3B%20I%20tried%2C%20I%20think%2C%20as%20you%20said%2C%20I%20turned%20IPV6%20off%2C%20I%20set%20Google%208.8.8.8%20and%208.8.4.4%20as%20my%20DNS%20and%20I%20logged%20on%20to%20my%20VPN%20(I%20work%20100%25%20remote)%2C%20and%20all%20are%20doing%20exactly%20what%20you%20are%20having%2C%20my%20prompt%20for%20-UseWebLogin%3C%2FP%3E%3CP%3EConnect-PnPOnline%20-Url%20%24SiteURL%20-UseWebLogin%3C%2FP%3E%3CP%3EBelow%20is%20a%20screenshot%20from%20a%20video%20I%20took%20of%20it.%26nbsp%3B%20I%20tried%20to%20uninstall%20and%20install%20it%20again%20(PNP)%20as%20it%20happens%20on%20my%20user%20account%20and%20on%20another%20account%20that%20I%20tried%20(my%20admin%20account).%3C%2FP%3E%3CP%3EJust%20like%20you%2C%20the%20prompt%20comes%20up%20for%20a%20millisecond%20and%20then%20goes%20away.%26nbsp%3B%20I%20have%20put%20in%20my%20HOSTS%20file%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E127.0.0.1%20msoid.summitservices.us.com%20%23%20fix%20PnP%20connect%20problem%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eand%20restarted%20as%20I%20tried%20right%20after%20putting%20that%20in.%26nbsp%3B%20I%20am%20on%20a%20Windows%2010%20system%20and%20I%20am%20running%20PowerShell%20v5.x%20as%20Admin.%26nbsp%3B%20I%20tried%20with%20PowerShell%20v7%20as%20well.%26nbsp%3B%20All%20the%20same.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222021-01-05_11-01-23.jpg%22%20style%3D%22width%3A%20800px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F244315i355C7BE4AAC5B1E8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222021-01-05_11-01-23.jpg%22%20alt%3D%222021-01-05_11-01-23.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2034375%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2034375%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F109565%22%20target%3D%22_blank%22%3E%40Matthew%20Carter%3C%2FA%3E%26nbsp%3BI%20never%20could%20get%20that%20to%20work%20and%20eventually%20took%20a%20different%20route%20using%20the%26nbsp%3BSharePointOnlinePowerShell%20module.%20I%20was%20able%20to%20connect%20using%20an%20administrative%20account%20with%26nbsp%3BConnect-SPOService%20-Url%20%3CA%20href%3D%22https%3A%2F%2FMYDOMAIN-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2FMYDOMAIN-admin.sharepoint.com%3C%2FA%3E.%20This%20brings%20up%20the%20web-based%20login%20window%2C%20which%20stays%20up.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20pressed%20on%20other%20projects%20since%20that%20limited%20success%2C%20so%20haven't%20pursued%20things%20further.%20I%20wanted%20to%20supply%20login%20credential%20in%20a%20script%20to%20avoid%20interactive%20logins%2C%20but%20never%20got%20that%20far.%20Let%20me%20know%20if%20you%20have%20any%20success%20along%20those%20lines.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2098638%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2098638%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F353385%22%20target%3D%22_blank%22%3E%40KenStewart%3C%2FA%3E%26nbsp%3BI%20was%20having%20a%20similar%20issue%20but%20I%20deleted%20all%20the%20temp%20files%20and%20cookies%20in%20IE%20and%20then%20it%20started%20up.%20Hope%20it%20helps!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2100774%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2100774%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F217567%22%20target%3D%22_blank%22%3E%40Joshua%20Bines%3C%2FA%3E%26nbsp%3Bthanks%20for%20the%20reply.%20That%20was%20one%20of%20my%20first%20steps%20based%20on%20earlier%20advice%20from%20another%20forum.%20It's%20plausible%20that%20the%20underlying%20code%20uses%20some%20of%20the%20old%20IE%20engine%2C%20or%20perhaps%20some%20of%20it's%20local%20data%20repository%2C%20but%20that%20didn't%20help%20in%20my%20case.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2103514%22%20slang%3D%22en-US%22%3ERe%3A%20Connect-PnPOnline%20-UseWebLogin%20fails%2C%20login%20window%20disappears%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2103514%22%20slang%3D%22en-US%22%3E%3CP%20data-unlink%3D%22true%22%3EThank%20you%20I%20also%20want%20to%20launch%20an%20%3CA%20href%3D%22https%3A%2F%2Fmultiapkclub.com%2Fwhatsapp-plus-app%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eapp%3C%2FA%3E%20for%20my%20website%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

I downloaded the latest version of PnP PowerShell today but have had no success with Connect-PnPOnline (no problem using Connect-SPOService). I get the dreaded error "For security reasons DTD is prohibited in this XML document." I've researched this and tried all the fixes, like disabling IPv6 and pointing to Google DNS servers. I've also tried Windows and Generic Credentials, but these don't avoid the online authentication and get the same error.

 

The most promising work-around appeared to be the -UseWebLogin option, but the window disappears. It's only up for a fraction of a second, which isn't long enough for me to read the single line of text there.

 

Can anyone solve the case of the missing -UseWebLogin window? This is an Office 365 E3 tenant.

16 Replies
best response confirmed by KenStewart (Contributor)
Solution
Have you tried amending your hosts file?

You're a lifesaver, @Deleted. I saw that fix from Paul Ryan online, but I neglected to try it. So in response to your post, I added this entry to my hosts file:

 

127.0.0.1 msoid.summitservices.us.com # fix PnP connect problem

 

where our domain is summitservices.us.com. I connected first time without an authentication dialog (since I'd already set up Windows Credentials). I ran a few other applets as a quick test, all successful.

 

You definitely solved my main problem, but I tried to connect again using -UseWebLogin with the same result: quickly disappearing window. The mystery remains.

Happy to help :)

When -UseWebLogin quickly disappears, could it be you are already authenticated.

If you run Get-PnPContext it should give you that info.

Looks like that's not exactly it, but there are more clues.

 

I opened a new PowerShell session and ran Get-PnPContext just to make sure there was no connection; returned an error saying I needed a connection first. I ran connect again with the web option, and the window still disappears. However, this time I asked for the context again and I was authenticated.

 

Apparently, something is bypassing a web dialog and trying a different authorization mechanism, which now succeeds because of the hosts configuration. To test this, I tried to connect to a different site that I hadn't configured with Credentials Manager; failed saying needed connection. Ran again with web option, window disappeared, but no error. Get-PnPContext then showed the new site.

 

Interesting, but still a little mystery? Isn't -UseWebLogin supposed to bring up a dialog to enter username and password?

It is, but it sounds like it already has authentication credentials.

Does it still happen after clearing all web cache, cookies etc?

Good thoughts, haven't tried yet. Need to get some work done for a while. Will try later and let you know.

 

Thanks again.

So, I may have taken a step backwards. After taking a break for a day, connecting no longer worked as smoothly as it did when I first modified the hosts file. I didn't change anything that I'm aware of, and I checked that hosts was the same. Long story short, I can connect but always have to add the -UseWebLogin parameter. Get-PnPConnection returns:

 

ConnectionType : O365
InitializationType : Unknown
MinimalHealthScore : -1
RetryCount : 10
RetryWait : 1
PSCredential :
TelemetryClient : Microsoft.ApplicationInsights.TelemetryClient
Url : https://summitservicesus.sharepoint.com/
TenantAdminUrl :
Context : OfficeDevPnP.Core.PnPClientContext

 

Note ConnectionType is O365 and PSCredential is null. When it was working smoothly, my recollection is that PSCredential was populated, though I don't remember the specifics. Regardless, I haven't been denied permission yet on any cmdlets I've run (mostly gets).

 

Following your suggestion, I did try clearing cache first then cookies and history. There was no apparent difference in behavior.

 

Interesting. Which version of the PnP cmdlets are you using?

Just downloaded 3.12.1908.1

When I say just, I mean just a few days ago. This is my first foray into SP online applets.

Are you still using the Google DNS?

Yes, I confirmed all the setting changes I'd made trying to fix the original problem (e.g., hosts, IPv6, Google DNS, Windows creds, etc.) are still in place.

@KenStewart did you ever get this working?  I tried, I think, as you said, I turned IPV6 off, I set Google 8.8.8.8 and 8.8.4.4 as my DNS and I logged on to my VPN (I work 100% remote), and all are doing exactly what you are having, my prompt for -UseWebLogin

Connect-PnPOnline -Url $SiteURL -UseWebLogin

Below is a screenshot from a video I took of it.  I tried to uninstall and install it again (PNP) as it happens on my user account and on another account that I tried (my admin account).

Just like you, the prompt comes up for a millisecond and then goes away.  I have put in my HOSTS file 

127.0.0.1 msoid.summitservices.us.com # fix PnP connect problem

and restarted as I tried right after putting that in.  I am on a Windows 10 system and I am running PowerShell v5.x as Admin.  I tried with PowerShell v7 as well.  All the same.

2021-01-05_11-01-23.jpg

PS C:\WINDOWS\system32> Get-PnPContext RetryCount : 10 Delay : 500 PropertyBag : {} Web : Microsoft.SharePoint.Client.Web Site : Microsoft.SharePoint.Client.Site RequestResources : Microsoft.SharePoint.Client.RequestResources FormDigestHandlingEnabled : True ServerVersion : Url : https://TENANTNAME-admin.sharepoint.com/ ApplicationName : SharePoint PnP PowerShell Library ClientTag : DisableReturnValueCache : True ValidateOnClient : True AuthenticationMode : Default FormsAuthenticationLoginInfo : Credentials : WebRequestExecutorFactory : Microsoft.SharePoint.Client.DefaultWebRequestExecutorFactory PendingRequest : Microsoft.SharePoint.Client.ClientRequest HasPendingRequest : True Tag : RequestTimeout : 180000 StaticObjects : {[SharePointPnP$Settings$ContextCloning, PnP.Framework.Utilities.Context.ClientContextSettings], [Microsoft$SharePoint$SPContext$Current, Microsoft.SharePoint.Client.RequestContext]} ServerSchemaVersion : ServerLibraryVersion : RequestSchemaVersion : 15.0.0.0 TraceCorrelationId : PS C:\WINDOWS\system32>

@Matthew Carter I never could get that to work and eventually took a different route using the SharePointOnlinePowerShell module. I was able to connect using an administrative account with Connect-SPOService -Url https://MYDOMAIN-admin.sharepoint.com. This brings up the web-based login window, which stays up.

 

I've been pressed on other projects since that limited success, so haven't pursued things further. I wanted to supply login credential in a script to avoid interactive logins, but never got that far. Let me know if you have any success along those lines.

@KenStewart I was having a similar issue but I deleted all the temp files and cookies in IE and then it started up. Hope it helps! 

@Joshua Bines thanks for the reply. That was one of my first steps based on earlier advice from another forum. It's plausible that the underlying code uses some of the old IE engine, or perhaps some of it's local data repository, but that didn't help in my case.