This post was most recently updated on April 13th, 2019.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 :)
Remember them and you should be good – at least for this case!
- Why you shouldn’t attach files from other channels in Microsoft Teams? - March 19, 2020
- Top Tips To Survive Working From Home! - March 10, 2020
- Adding new MVC/Razor items fails throwing an error about hostpolicy.dll - March 5, 2020