I am running this power shell command:

$username = 'admin***@M*****.onmicrosoft.com'
$password = '******@@'
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
Connect-SPOService -Url https://****-admin.sharepoint.com -Credential $cred

but I will get this error:

Connect-SPOService : The sign-in name or password does not match one in the Microsoft account system.
At line:1 char:1
+ Connect-SPOService -Url https://*****-admin.sharepoint. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-SPOService], IdcrlException
    + FullyQualifiedErrorId : Microsoft.SharePoint.Client.IdcrlException,Microsoft.Online.SharePoint.PowerShell.Connec

Although I am passing accurate username/password, and using the same credentials I can access the SharePoint admin site from the browser. where after entering the username/password I will get this message on the browser:

enter image description here

and clicking on next I can access the SharePoint admin site.

Any advice?

  • 1
    Is MFA enabled for this user account? Jun 18, 2022 at 9:12
  • @GaneshSanap yes it is
    – John John
    Jun 18, 2022 at 9:15
  • try below suggestions in my answer. Jun 18, 2022 at 9:19

1 Answer 1


You can use SharePoint Online Management Shell to connect with multi-factor authentication (MFA) SharePoint Site.

Connect-SPOService -Url https://contoso-admin.sharepoint.com

Follow below documentation:

To connect with multi-factor authentication (MFA).


Using PnP PowerShell UseWebLogin:

Connect-PnPOnline -Url $siteUrl –UseWebLogin


Connect-PnPOnline -Url $siteUrl -Interactive

enter image description here


Using App Password:

Also, you can use App password in place of normal password to login easily.

I am using App Password for authentication in PowerShell as well as SharePoint Designer and it works well.

Create an app password for Office 365.

Similar thread: The sign-in name or password does not match one in the Microsoft account system

  • 1
    The important thing is to leave out the credentials so that the web login is shown.
    – mm201
    Oct 23, 2023 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.