Before you run any SharePoint cmdlet, you have to connect SharePoint Administration center. To create a SharePoint Online Connection you must have SharePoint Online Administrator rights.

The Connect-SPOService cmdlet connects a SharePoint Online administrator or Global Administrator to the SharePoint Online Administration Center. Below are the ways to connect SharePoint administration Center:

$username = "admin@expertbrains.sharepoint.com"
$password = "password"
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist                             $userName, $(convertto-securestring $Password -asplaintext -force)
Connect-SPOService -Url https://expertbrains-admin.sharepoint.com -Credential $cred

Connect-SPOService -Url https://expertbrains-admin.sharepoint.com -credential admin@expertbrains.com

Connect-SPOService -Url https://expertbrains-admin.sharepoint.com