while connecting to sharepoint online power shell error coming up

sns 9,226 Reputation points
2021-01-26T07:02:54.47+00:00

Although credentials are correct, while connecting to SharePoint online power shell error coming up
Please find attached screenshot

I have used -useweblogin this worked for PnPpowershell but not sharepoint online powershell
However I don't want to use -useweblogin

How should I fix this issue? Please help

FYI: while creating tenant it asked for 2FA so I had to install 2FA app on mobile to authenticate.
60502-capture.jpg

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,872 questions
0 comments No comments
{count} votes

Accepted answer
  1. Echo Du_MSFT 17,116 Reputation points
    2021-01-27T02:29:04.77+00:00

    Hi @sns ,

    Please confirm if you have the required module (and also if you need an update), and use:

    Install-Module -Name Microsoft.Online.SharePoint.PowerShell  
    

    Then execute the following PowerShell commal

    Connect-SPOService -url https://domain-admin.sharepoint.com  
    

    After you hit Enter, you will see a familiar Office 365 login page.

    Finally, enter the Admin name and password

    60765-1.png

    Thanks,
    Echo Du

    =============

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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 comments No comments

3 additional answers

Sort by: Most helpful
  1. Vasil Michev 97,076 Reputation points MVP
    2021-01-26T08:21:00.713+00:00

    Do not use the -Credentials parameter, doing this forces basic authentication, which will not work in your case. Run the cmdlet with just the URL parameter, this will cause a credentials prompt to pop up, similar to the -userweblogin switch for PnP.


  2. sns 9,226 Reputation points
    2021-01-26T10:46:12.24+00:00

    How to update? Please address


  3. Trevor Seward 11,691 Reputation points
    2021-01-26T15:38:40.783+00:00

    Run Connect-SPOService https://tenantName-admin.sharepoint.com. This will bring up a dialog box for Modern Auth where you can enter your username/password and complete the MFA prompt.

    0 comments No comments