Monday, 24 December 2018

PowerShell Function to Connect to Office 365 Exchange Online


Connect to office365 and Azure in one window. 

 Function ConnectTo365 {

$credential = Get-Credential

Connect-MsolService -Credential $credential

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

Import-PSSession $exchangeSession -DisableNameChecking

}