13 January 2017

Sign into Office 365 | PowerShell

The following commands are used to sign into the PowerShell side of Office 365.  This is mainly for my use as I have to keep Googling where to find it.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

If you need to use the MSOL commands, you will need to sign into that too, which you can use the following command:

Connect-MsolService -Credential $UserCredential

1 comment: