Powershell 5 and later:
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Connexion username and password:
$adminUPN=”s*****@octavemaecenas.com”
$orgName=”octavemaecenas”
$userCredential = Get-Credential -UserName $adminUPN -Message “Type the password.”
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
Multifactor connection:
$orgName=”<name of your Office 365 organization, example: contosotoycompany>” Connect-SPOService -Url https://$orgName-admin.sharepoint.com