Connect to O365 via Powershell 5.1 on Windows 10
Azure AD via MSOnline (old but still sometimes usefull)
[https://docs.microsoft.com/en-us/powershell/module/msonline/?view=azureadps-1.0] If you are using MFA this will only work using an App password
Set-ExecutionPolicy RemoteSigned
Install-Module -Name MSOnline
Import-Module MSOnline; Get-Module MSOnline
# Update: Update-Module -Name MSOnline
$Cred = Get-Credential
Connect-MsolService -Credential $cred
AzureAD
Set-ExecutionPolicy RemoteSigned
Install-Module -Name AzureAD
Import-Module AzureAD; Get-Module AzureAD
# Update: Update-Module -Name AzureAD
Connect-AzureAD
Disconnect AzureAD
Disconnect-AzureAD
Exchange Online
[https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps]
$Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
Exchange Online EXO V2
[https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps]
Set-ExecutionPolicy RemoteSigned
Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement; Get-Module ExchangeOnlineManagement
# Update: Update-Module -Name ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName user@domain.com -ShowProgress $true
Exchange Online Remote PowerShell V2
[https://docs.microsoft.com/en-us/powershell/exchange/mfa-connect-to-exchange-online-powershell?view=exchange-ps] Install the Exchange Online Remote PowerShell Module from the Exchange admin center (see link above)
Connect-EXOPSSession -UserPrincipalName user@domain.com
SharePoint Online
[https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps]
Set-ExecutionPolicy RemoteSigned
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking; Get-Module Microsoft.Online.SharePoint.PowerShell
# Update: Update-Module -Name Microsoft.Online.SharePoint.PowerShell
$orgName="<for example, litwareinc for litwareinc.onmicrosoft.com>"
-Url https://$orgName-admin.sharepoint.com
Connect-SPOService
Skype for Business
[https://docs.microsoft.com/en-us/office365/enterprise/powershell/manage-skype-for-business-online-with-office-365-powershell] (Download and install the Skype for Business Online PowerShell Module)[https://www.microsoft.com/en-us/download/details.aspx?id=39366]
Import-Module SkypeOnlineConnector; Get-Module SkypeOnlineConnector
# Update: Update-Module -Name SkypeOnlineConnector
$acctName="<UPN of the account, such as belindan@litwareinc.onmicrosoft.com>"
$sfboSession = New-CsOnlineSession -UserName $acctName
Import-PSSession $sfboSession
Teams
[https://docs.microsoft.com/en-us/MicrosoftTeams/teams-powershell-overview]
Set-ExecutionPolicy RemoteSigned
Install-Module -Name MicrosoftTeams
Import-Module MicrosoftTeams; Get-Module MicrosoftTeams
# Update: Update-Module -Name MicrosoftTeams
Import-Module MicrosoftTeams
Connect-MicrosoftTeams
Disconnect PSSession
Remove-PSSession $Session
# or
Get-PSSession | Remove-PSSession
Connect all in one single PowerShell window
Once you have all the modules installed you can run all commands in a single PS window [https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-all-office-365-services-in-a-single-windows-powershell-window]
$acctName="<UPN of the account, such as belindan@litwareinc.onmicrosoft.com>"
$orgName="<for example, litwareinc for litwareinc.onmicrosoft.com>"
#Azure Active Directory
Connect-AzureAD
#SharePoint Online
Connect-SPOService -Url https://$orgName-admin.sharepoint.com
#Skype for Business Online
$sfboSession = New-CsOnlineSession -UserName $acctName
Import-PSSession $sfboSession
#Exchange Online
Connect-ExchangeOnline -UserPrincipalName $acctName -ShowProgress $true
#Teams
Import-Module MicrosoftTeams
Connect-MicrosoftTeams
