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

Microsoft 365 PowerShell - error while executing Connect-SPOService - One or more error occurred
Microsoft 365 PowerShell - error while executing Connect-SPOService - One or more error 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
Microsoft 365 PowerShell - error while executing Connect-SPOService - One or more error occurred
fig: Microsoft 365 PowerShell – error while executing Connect-SPOService – One or more error occurred

Details

  • By default, the Connect-SPOService cmdlet uses the legacy authentication.
  • To resolve this issue, use the ModernAuth parameter included in SharePoint Online Management Shell version 16.0.22601.12000 and later versions.
  • This parameter must be used together with the AuthenticationUrl parameter.
  • 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.
Microsoft 365 PowerShell - Connect-SPOService - CMDLET executed successfully with parameter "AuthenticationUrl" and "ModernAuth" parameters
fig: Microsoft 365 PowerShell – Connect-SPOService – CMDLET executed successfully with parameter “AuthenticationUrl” and “ModernAuth” parameters

REFERENCES

Thanks for reading. Stay tuned for all Microsoft 365 updates / details / issues – solution / tutorials 🙂

HAVE a FANTASTIC LEARNING AHEAD ! LIFE IS BEAUTIFUL 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Microsoft 365

Subscribe now to keep reading and get access to the full archive.

Continue reading