Commands › Exchange Online

Connect-ExchangeOnline

Exchange Online ExchangeOnlineManagement Connect-*

For more information, see About the Exchange Online PowerShell module. Use the Connect-ExchangeOnline cmdlet in the Exchange Online PowerShell module to use modern authentication to connect to Exchange Online PowerShell or PowerShell for the Built-in security add-on for on-premises mailboxes. This cmdlet works for accounts with or without multi-factor authentication (MFA). To connect to Security & Compliance PowerShell, use the Connect-IPPSSession cmdlet.

Quick start script

# Connect-ExchangeOnline — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Run and inspect
Connect-ExchangeOnline | Format-List

# 3. Export for evidence / drift tracking
Connect-ExchangeOnline | Export-Clixml .\ExchangeOnline-$(Get-Date -Format yyyyMMdd).xml

Syntax

Connect-ExchangeOnline
 [[-ConnectionUri] <String>]
 [[-AzureADAuthorizationEndpointUri] <String>]
 [[-ExchangeEnvironmentName] <ExchangeEnvironment>]
 [[-PSSessionOption] <PSSessionOption>]
 [[-DelegatedOrganization] <String>]
 [[-Prefix] <String>]
 [[-CommandName] <String[]>]
 [[-FormatTypeName] <String[]>]
 [-AccessToken <String>]
 [-AppId <String>]
 [-BypassMailboxAnchoring]
 [-Certificate <X509Certificate2>]
 [-CertificateFilePath <String>]
 [-CertificatePassword <SecureString>]
 [-CertificateThumbprint <String>]
 [-Credential <PSCredential>]
 [-Device]
 [-DisableWAM]
 [-EnableErrorReporting]
 [-EXOModuleBasePath <String>]
 [-InlineCredential]
 [-LoadCmdletHelp]
 [-LogDirectoryPath <String>]
 [-LogLevel <LogLevel>]
 [-ManagedIdentity]
 [-ManagedIdentityAccountId <String>]
 [-Organization <String>]
 [-PageSize <UInt32>]
 [-ShowBanner]
 [-ShowProgress <Boolean>]
 [-SigningCertificate <X509Certificate2>]
 [-SkipLoadingCmdletHelp]
 [-SkipLoadingFormatData]
 [-TrackPerformance <Boolean>]
 [-UseMultithreading <Boolean>]
 [-UserPrincipalName <String>]
 [-UseRPSSession]
 [<CommonParameters>]

Parameters (37)

ParameterTypeRequiredWhat it controls
-ConnectionUri String **Note**: If you use the ExchangeEnvironmentName parameter, you don't need to use the AzureADAuthorizationEndpointUri or ConnectionUri parameters.
-AzureADAuthorizationEndpointUri String **Note**: If you use the ExchangeEnvironmentName parameter, you don't need to use the AzureADAuthorizationEndpointUri or ConnectionUri parameters.
-ExchangeEnvironmentName ExchangeEnvironment The ExchangeEnvironmentName specifies the Exchange Online environment and eliminates the need to use the AzureADAuthorizationEndpointUri and ConnectionUri parameters. The following Exchange Online PowerShell...
-PSSessionOption PSSessionOption **Note**: This parameter doesn't work in REST API connections.
-DelegatedOrganization String The DelegatedOrganization parameter specifies the customer organization that you want to manage. A valid value for this parameter is the primary .onmicrosoft.com domain or tenant ID of the customer organization.
-Prefix String The Prefix parameter specifies a text value to add to the names of Exchange Online PowerShell cmdlets when you connect. For example, Get-InboundConnector becomes Get-ContosoInboundConnector when you use the value...
-CommandName String[] The CommandName parameter specifies the comma separated list of commands to import into the session. Use this parameter for applications or scripts that use a specific set of cmdlets. Reducing the number of cmdlets...
-FormatTypeName String[] The FormatTypeName parameter specifies the output format of the cmdlet.
-AccessToken String **Note**: This parameter is available in module version 3.1.0-Preview1 or later.
-AppId String The AppId parameter specifies the application ID of the service principal that's used in certificate based authentication (CBA). A valid value is the GUID of the application ID (service principal). For example,...
-BypassMailboxAnchoring SwitchParameter The BypassMailboxAnchoring switch bypasses the use of the mailbox anchoring hint. You don't need to specify a value with this switch.
-Certificate X509Certificate2 The Certificate parameter specifies the certificate that's used for certificate-based authentication (CBA). A valid value is the X509Certificate2 object value of the certificate.
-CertificateFilePath String The CertificateFilePath parameter specifies the certificate that's used for CBA. A valid value is the complete public path to the certificate file. Use the CertificatePassword parameter with this parameter.
-CertificatePassword SecureString The CertificatePassword parameter specifies the password that's required to open the certificate file when you use the CertificateFilePath parameter to identify the certificate that's used for CBA.
-CertificateThumbprint String The CertificateThumbprint parameter specifies the certificate that's used for CBA. A valid value is the thumbprint value of the certificate. For example, `83213AEAC56D61C97AEE5C1528F4AC5EBA7321C1`.
-Credential PSCredential The Credential parameter specifies the username and password that's used to connect to Exchange Online PowerShell. Typically, you use this parameter in scripts or when you need to provide different credentials that...
-Device SwitchParameter **Note**: This parameter is available in module version 2.0.4-Preview6 or later, and only in PowerShell 7.
-DisableWAM SwitchParameter **Note**: This parameter is available in module version 3.7.2-Preview1 or later.
-EnableErrorReporting SwitchParameter The EnableErrorReporting switch specifies whether to enable error reporting. You don't need to specify a value with this switch.
-EXOModuleBasePath String **Note**: This parameter is available in module version 3.9.1-Preview1 or later.
-InlineCredential SwitchParameter **Note**: This parameter is available in module version 2.0.4-Preview6 or later, and only in PowerShell 7.
-LoadCmdletHelp SwitchParameter **Note**: This parameter is available in module version 3.7.0-Preview1 or later.
-LogDirectoryPath String The LogDirectoryPath parameter specifies the location of the log files. The default location is `%TMP%\EXOCmdletTelemetry\EXOCmdletTelemetry-yyyymmdd-hhmmss.csv`.
-LogLevel String The LogLevel parameter specifies the logging level. Valid values are Default and All.
-ManagedIdentity SwitchParameter The ManagedIdentity switch specifies that you're using managed identity to connect. You don't need to specify a value with this switch.
-ManagedIdentityAccountId String The ManagedIdentityAccountId parameter specifies the user-assigned managed identity that you're using to connect. A valid value for this parameter is the application ID (GUID) of the service principal that...
-Organization String The Organization parameter specifies the organization when you connect using CBA or managed identity. A valid value for this parameter is the primary .onmicrosoft.com domain of the organization.
-PageSize UInt32 The PageSize parameter specifies the maximum number of entries per page. Valid input for this parameter is an integer between 1 and 1000. The default value is 1000.
-ShowBanner SwitchParameter The ShowBanner switch shows or hides the banner message that's displayed when you run Connect-ExchangeOnline. You don't need to specify a value with this switch.
-ShowProgress Boolean The ShowProgress parameter specifies whether to show or hide the progress bar of imported cmdlets when you connect. Valid values are:
-SigningCertificate X509Certificate2 **Note**: This parameter is available in module version 3.2.0-Preview4 or later.
-SkipLoadingCmdletHelp SwitchParameter **Note**: This parameter is available in module version 3.3.0-Preview1 or later.
-SkipLoadingFormatData SwitchParameter The SkipLoadingFormatData switch prevents downloading the format data for REST API connections. You don't need to specify a value with this switch.
-TrackPerformance Boolean The TrackPerformance parameter measures additional events (for example, CPU load and memory consumed). Valid values are:
-UseMultithreading Boolean The UseMultithreading parameter specifies whether to disable or enable multi-threading in the Exchange Online PowerShell module. Valid values are:
-UserPrincipalName String The UserPrincipalName parameter specifies the account that you want to use to connect (for example, `navin@contoso.onmicrosoft.com`). Using this parameter allows you to skip entering a username in the modern...
-UseRPSSession SwitchParameter **Note**: This parameter is deprecated in module version 3.9.2 or later. REST API connections replaced Remote PowerShell connections in Exchange Online PowerShell in October 2023. For more information, see...

Message Center changes mentioning this command

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.