pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
989 stars 662 forks source link

[BUG] Isolating why Connect-PnPOnline fails for some accounts? #2812

Open breakpoint7 opened 4 years ago

breakpoint7 commented 4 years ago

We've run into a scenario where Connect-PnPOnline fails for some accounts that are configured (as best we can tell) identically. Using PnP version - SharePointPnPCoreOnline.3.23.2007

All these accounts succeed with -UseWebLogin and other variations of auth, but we're finding that the same call to pass creds will fail on some of the accounts. All of them are setup the same in terms of AD enabled legacy and excluded from MFA. It's not clear if this is a bug or there's some other difference.

For example making the same call with three identically configured accounts and passing creds: Connect-PnPOnline -Url "https://mytenant.sharepoint.com" -Credentials $creds Error: 62@mytenant.com : The sign-in name or password does not match one in the Microsoft account system. Error: 63@mytenant.com : The sign-in name or password does not match one in the Microsoft account system. Success: 64@mytenant.com

62@mytenant.com : Microsoft.SharePoint.Client.IdcrlException: The sign-in name or password does not match one in the Microsoft account system. at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String securityXml, String serviceTarget, String servicePolicy) ...

Is there a recommended way to further isolate this (specific logs or tracing to show why it fails) or known issues that might cause the behavior?

joshua-probst commented 4 years ago

"-Credential" doesnt support MFA. If you have activated MFA on your Site you can use "-UseWebLogin", "-SPOManagementShell" or "PnPManagementShell".