Fix “No connection available. Use Connect-SPOService before running this CmdLet.” Error in SharePoint Online PowerShell!
Problem: Getting this error, “No connection available. Use Connect-SPOService before running this CmdLet.” while trying to connect SharePoint Online via PowerShell through SharePoint Online Management Shell.
Solution:
You must connect to SharePoint Online Service using Connect-SPOService PowerShell cmdlet first before executing any other cmdlets for SharePoint Online.
#Step: 1: Connect to SharePoint Online
Connect-SPOService -url "https://Crescent-admin.sharepoint.com"
#Step 2: Run Cmdlet for SharePoint Online
Get-SPOUser -Site "https://Crescent.sharepoint.com/sites/marketing"
On running the Connect-SPOService cmdlet, you’ll be prompted to enter credentials. On a successful connection, You can proceed with running desired cmdlets. Don’t forget to replace the Tenant admin URL “https://Crescent-admin.sharepoint.com” with “https://YOURDOMAIN-admin.sharepoint.com”.
Many thanks ! worked for me