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!
He's been a developer from 2004 (starting with PHP and Java), and he's been bending and twisting SharePoint into different shapes since MOSS. Nowadays he's not only working on SharePoint, but also on .NET projects, Azure, Office 365 and a lot of other stuff.
This is his personal professional (e.g. professional, but definitely personal) blog.
Latest posts by Antti K. Koskela (see all)
- Azure DevOps – how to package a simple DLL? - October 17, 2019
- How to use UriHelper or NavigationManager in .NET Core 3.0 & Blazor? - October 17, 2019
- Azure DevOps build fails with “The nuget command failed with exit code(1) and error(Cannot determine the packages folder to restore NuGet packages.” - October 16, 2019