Company News

Office 365 PS Modules – Quick & Dirty, Connect to all

April 28, 2016

For those of us that just want to get it done the first time vs. having to connect to each service separately. Here’s how you would connect to ALL O365 Services in one GO.


Reference – For long and short explanations on the “how to”


Modules Required


The Quick & Dirty

#Connect to MSOnline

$credential = Get-Credential

Import-Module MsOnline

Connect-MsolService -Credential $credential


#Connect to SharePoint Online

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

Connect-SPOService -Url -credential $credential


#Connect to Exchange Online

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “” -Credential $credential -Authentication “Basic” -AllowRedirection

Import-PSSession $exchangeSession -DisableNameChecking


#Connect to Security and Compliance Online

$ccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $credential -Authentication Basic -AllowRedirection

Import-PSSession $ccSession -Prefix cc


#Uncomment this to connect to Skype Online

#Import-Module SkypeOnlineConnector

#$sfboSession = New-CsOnlineSession -Credential $credential

#Import-PSSession $sfboSession


To close session

Remove-PSSession $sfboSession ; Remove-PSSession $exchangeSession ; Remove-PSSession $ccSession ; Disconnect-SPOService



One Response

  1. Rob de Jong says:

    Hi Stephanie,

    I noticed you are using the older MSOnline PowerShell module in your examples. It may be useful to start using the newer Azure Active Directory PowerShell V2 module instead, as we will begin deprecating the MSOnline module when we have migrated the functionality of the MSOnline module to the newer module – currently planned for the Spring of 2017.


    Rob de Jong

Leave a Reply

Stephanie Kahlam

Stephanie Kahlam


Subscribe via Email


Powered by...

itgroove Corporate Profile
Connect With Us