question

NargessMojtahedi-5073 avatar image
0 Votes"
NargessMojtahedi-5073 asked tbgangav-MSFT answered

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

Hi
Hi
I tried to use **"Connect-SPOService" in my Runbooks and it worked fine, but from 2 days ago it started failing.

Connect-SPOService -Url "https://xxxx-admin.sharepoint.com/" -Credential $ serviceAccountCred

It works fine when I try it in Windows Powershell.

I have installed:
Microsoft.Online.SharePoint.PowerShell 16.0.22315.12000

and MFA is disabled and my account is Global admin.
It does not fail when I use Connect-PnPOnline and Connect-AzureAD.




office-sharepoint-onlineoffice-sharepoint-server-developmentazure-ad-multi-factor-authenticationazure-automation
· 10
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @nargessmojtahedi-5073 ,

This is a quick note to let you know that we are performing research on this issue.

Thanks,
Echo Du

0 Votes 0 ·

Hi @nargessmojtahedi-5073 ,

Welcome to Q&A Forum!

Connect-SPOService : The sign-in name or password does not match one in the Microsoft account system.

There are two possible reasons for this error – either you have made a mistake while inserting your credentials, or you have a multifactor authentication enabled (MFA).

If it is due to the MFA, you will need to remove the -Credential parameter while connecting to SharePoint Online and enter your credentials with the traditional, login page experience.

Please follow the steps:

1.Check if the user has MFA turned on

191681-a.jpg

2.Make sure the password is entered correctly

191605-b.jpg

191606-c.jpg

3.If you still get an error, it is recommended that you change the password of this account and then test.

191643-d.jpg

Thanks,
Echo Du
=======================================
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




0 Votes 0 ·
a.jpg (74.6 KiB)
b.jpg (65.4 KiB)
c.jpg (73.8 KiB)
d.jpg (98.4 KiB)

Hi @nargessmojtahedi-5073 ,

Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

Thanks,
Echo Du

0 Votes 0 ·

Hi, thanks for your answer, but I still get error.

I am using a service account and MFA is disabled.
It fails when I run "Connect-SPOService" in a Runbook.
when I run the script in "Windows Powershell", it runs without error.



194695-image.png



Thanks, Nargess

0 Votes 0 ·
image.png (27.3 KiB)
EchoDu-MSFT avatar image EchoDu-MSFT NargessMojtahedi-0974 ·

Hi @nargessmojtahedi-5073 ,

Could you run your script using SharePoint Online Management Shell to check if this issue is related to the third party tool "Runbook"?

The SharePoint Online Management Shell is a Windows PowerShell module that you can use to manage SharePoint settings at the organization level and site collection level. You can download it via Microsoft Download Center.

Reference:

Thanks,
Echo Du





0 Votes 0 ·
Show more comments

Hi
I checked it and it is disabled.




0 Votes 0 ·

Hi @NargessMojtahedi-5073,

If you are globaladmin and are using same service account and disabled MFA and if it works without any issue in PowerShell and only fails in Runbook and then error "Connect-SPOService : The sign-in name or password does not match one in the Microsoft account system" might not be because of wrong URL or credentials or expiry so I would recommend to double-check if your Azure environment has any conditional access policy or any other policy to block basic authentication causing the runbook to fail.

To try diagnosing and troubleshooting the cause of the issue here it would require deep dive with the help of access to your environment and related troubleshooter logs and traces if required. Hence, I thought of recommending you to raise a Azure technical support ticket but I see that you already have raised it yesterday (with case ID 2204250050000842). I hope it gets resolved with the help of Azure technical support.

On the other hand, as recommended above, let me know if your Azure environment has any conditional access policy or any other policy to block basic authentication causing the runbook to fail and if that's the case then excluding your service account from those might resolve the issue.

0 Votes 0 ·

1 Answer

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered

Hi @NargessMojtahedi-5073,

<<Sharing the summary of Azure technical support request here so it would benefit the other members of the Microsoft Q&A community who might be looking for similar information.>>

Issue:

Runbook was failing with the error: "The sign-in name or password does not match one in the Microsoft account system" when trying to connect to SPO service.

Cause:

Customer environment has a Conditional Access Policy that blocks legacy authentication. Microsoft.Online.SharePoint.PowerShell module does not work with modern authentication in unattended mode.

Solution:

In this scenario there is no perfect solution as on one hand the Azure Runbook nature that doesn’t allow any interactivity and on the other hand there are PowerShell limitations. Workaround is either making an exclusion in the Conditional Access Policy that blocks legacy authentication for the user account or using the PnP module to connect to SharePoint Online.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.