0

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
   tSPOService

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?

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

1 Answer 1

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).


OR

Using PnP PowerShell UseWebLogin:

Connect-PnPOnline -Url $siteUrl –UseWebLogin

OR

Connect-PnPOnline -Url $siteUrl -Interactive

enter image description here


OR

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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