Connect to Exchange Online Protection PowerShell using modern authentication with or without MFA
Â
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName <UPN> [-UseRPSSession] [-PSSessionOption $ProxyOptions] [-ShowBanner:$false]
Connect to Security & Compliance PowerShell
The command that you need to run uses the following syntax:
Connect-IPPSSession -UserPrincipalName [-ConnectionUri ] [-AzureADAuthorizationEndpointUri ] [-DelegatedOrganization ] [-PSSessionOption $ProxyOptions]
Connect to Security & Compliance PowerShell with an interactive login prompt
This example connects to Security & Compliance PowerShell in a Microsoft 365 or Microsoft 365 GCC organization:
Connect-IPPSSession -UserPrincipalName navin@contoso.onmicrosoft.com
This example connects to Security & Compliance PowerShell in a Microsoft GCC High organization:
Connect-IPPSSession -UserPrincipalName chris@govt.us -ConnectionUri https://ps.compliance.protection.office365.us/powershell-liveid/ -AzureADAuthorizationEndpointUri https://login.microsoftonline.us/common
Azure Active Directory PowerShell for Graph module when using MFA
Here are all the commands in a single block to connect to multiple Microsoft 365 services when you use multi-factor authentication with the Microsoft Azure Active Directory Module for Windows PowerShell module.
$acctName="<UPN of the account, such as belindan@litwareinc.onmicrosoft.com>"
$orgName="<for example, litwareinc for litwareinc.onmicrosoft.com>"
#Azure Active Directory
Connect-MsolService
#SharePoint Online
Connect-SPOService -Url https://$orgName-admin.sharepoint.com
#Exchange Online
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName $acctName -ShowProgress $true
#Security & Compliance Center
Connect-IPPSSession -UserPrincipalName $acctName
#Teams and Skype for Business Online
Import-Module MicrosoftTeams
Connect-MicrosoftTeams