Most administration of Office 365 is done using the Office 365 Admin Center (https://portal.office.com/admin) eg license assignment, domain management, email maintenance (via Exchange Admin Center link) etc.
Administering Exchange via Powershell is still possible however there are extra steps involved due to increased security required in accessing cloud resources.
Below are the prerequisites and steps to connect to Office 365 via Powershell
- Windows 8, 10 or 2012/R2
- Microsoft.NET Framework 4.5 or later
1. On your local computer, open Windows Powershell (as local administrator) and run the following command.
$UserCredential = Get-Credential
In the Windows PowerShell Credential Request dialog box, type your Office 365 user name (eg admin@<tenant name>.onmicrosoft.com) and password and then click OK.
2. Run the following command.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
3. Run the following command.
4. You are now ready to enter your Powershell cmdlets,
eg: Get-MailboxStatistics joe.bloggs | ft DisplayName, TotalItemSize, ItemCount
5. (Important) When finished do not just click the top right X. Instead disconnect the remote Powershell session properly by running the command below.