Every time I’m sitting at a new computer and try to connect to Office 365 using PowerShell I normally have forgotten how.
I google for it and often the top result is either old information or just doesn’t work.
Some instructions ask you to install things like the Azure online services and Microsoft Online Services Sign in assistant.. some of which say you need higher versions of one installed and you try to install the newer version of the other it tells you a newer version is already installed.
I’ve found the best place to start is this set of documentation but also make sure you have run this command first:
(Note that you need to run powershell as an administrator to set this!)
Single Factor Authentication Admins:
Old Old URL (now dead link): http://help.outlook.com/en-gb/140/cc952755.aspx
The ExecutionPolicy commands followed by the connection commands from the above address worked fine on a stock Windows 8.1 computer without installing any extra programs!
Multiple factor authenctication enabled admin accounts:
Install Exchange Online Management: https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module
Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement</p> Connect-ExchangeOnline -ShowProgress $true -UserPrincipalName youradmin@emailaddress