Microsoft 365 POWERSHELL : Resolving error -Connect-SPOService : One or more errors occurred.

Hi All,
Greetings for the day!!!
Today new issue and resolution.
Background
- We want to connect to get the details of one site using “Get-SPOSite” CMDLET.
- So we are connecting to Microsoft 365 using “Connect-SPOService” CMDLET
$cred = Get-Credential
Connect-SPOService -Url https://knowledgejunction1-admin.sharepoint.com -Credential $cred
- While executing the “Connect-SPOService” we are getting an error.
Error / Issue
Connect-SPOService : One or more errors occurred.
At line:1 char:1
- Connect-SPOService -Url https://knowledgejunction1-admin.sharepoint.c …
~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (:) [Connect-SPOService], AggregateException
- FullyQualifiedErrorId : System.AggregateException,Microsoft.Online.SharePoint.PowerShell.ConnectSPOService

Details
- By default, the
Connect-SPOServicecmdlet uses the legacy authentication. - To resolve this issue, use the
ModernAuthparameter included in SharePoint Online Management Shell version 16.0.22601.12000 and later versions. - This parameter must be used together with the
AuthenticationUrlparameter. - So actual CMDLET should be like
Connect-SPOService -Credential $creds -Url https://knowledgejunction1-admin.sharepoint.com -ModernAuth $true -AuthenticationUrl https://login.microsoftonline.com/organizations
- As I execute this/above CMDLET, I am successfully connected to Microsoft 365.

REFERENCES
- Can’t connect to SharePoint Online when you run Connect-SPOService – https://learn.microsoft.com/en-us/sharepoint/troubleshoot/administration/connect-sposervice-error
Thanks for reading. Stay tuned for all Microsoft 365 updates / details / issues – solution / tutorials 🙂
HAVE a FANTASTIC LEARNING AHEAD ! LIFE IS BEAUTIFUL 🙂

You must be logged in to post a comment.