This post was most recently updated on June 4th, 2020.Reading Time: 2 minutes.
This post describes a simple way to get around the following error while running Connect-PnPOnline: “The sign-in name or password does not match one in the Microsoft account system.” Truthfully, this one is kind of simple and stupid – but as I’ve seen before, it’s surely worth documenting anyway!
Below is an example of such error.
PS C:\> Connect-PnPOnline https://contoso.sharepoint.com/sites/CommunicationSite/ Connect-PnPOnline : The sign-in name or password does not match one in the Microsoft account system. At line:1 char:1 + Connect-PnPOnline https://contoso.sharepoint.com/sites/CommunicationS ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Connect-PnPOnline], IdcrlException + FullyQualifiedErrorId : Microsoft.SharePoint.Client.IdcrlException,SharePointPnP.PowerShell.Commands.Base.ConnectOnline
In my case, I had saved my credentials in a password manager, yet in a script I was developing I ran into this error time and time again. I didn’t remember encountering it before, so my natural first guess was that the password had expired.
However, I could login with the account, so the password and username I was using were correct. Then what causes this?
Are you sure you have entered your username and password correctly? You are? Good.
Have you disabled the credential caching (see below)? Great.
If you’ve avoided all the abovementioned pitfalls, you might’ve ran into the same issue I did, and feel as stupid as me after reading the next sentence.
Quotes. You need quotes around the URL, even if it doesn’t contain a space. This issue might manifest if you are pasting values in the PowerShell – which is exactly what I did.
Without the quotes, the cmdlet returns this error. While the error might not be the most informative at first sight, it actually makes sense: since the cmdlet is not able to figure out where it’s trying to login with your credentials – technically, your sign-in name and password do not match the ones Microsoft supposedly has for whatever null tenant they’re trying to authenticate you against.
So, make sure to try and authenticate against an URL that makes sense. One, that has quotes around it :)
Another thing to verify, as Faisal points out in the comments -section below, is that you’re using -UseWebLogin switch if your user account has MFA turned on. Worth trying out in any case :)
- How to resolve “Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF” - June 30, 2020
- How to resolve persistent “Build started… Build failed.” when trying to run Entity Framework Core commands? - June 24, 2020
- SharePoint Home Sites – a Game Changer? - June 16, 2020