When managing Exchange Online through PowerShell, administrators may have multiple connections open, especially when working with different accounts or Microsoft 365 tenants.
Identifying which account, tenant, or endpoint a connection belongs to can become difficult, particularly when troubleshooting authentication issues or running administrative scripts.
The Get-ConnectionInformation cmdlet helps administrators inspect these connections and review their associated session details.
What Is the Get-ConnectionInformation Cmdlet?
Get-ConnectionInformation is an Exchange Online PowerShell cmdlet that retrieves information about active REST-based connections in the current PowerShell instance.
It serves a similar purpose to Get-PSSession, which administrators use to inspect traditional remote PowerShell sessions. However, the two commands work with different connection types and return different information.
Unlike Connect-ExchangeOnline, which establishes connections, Get-ConnectionInformation only retrieves existing connection details.
Syntax
Microsoft documents three syntax variants:
Get-ConnectionInformation
Get-ConnectionInformation -ConnectionId <String[]>
Get-ConnectionInformation -ModulePrefix <String[]>
All three variants support PowerShell common parameters.
Parameters
| Parameter | Description |
|---|---|
-ConnectionId |
Filters connections using one or more unique connection GUIDs. |
-ModulePrefix |
Filters connections using prefixes assigned when they were established. |
CommonParameters |
Supports standard parameters such as -Verbose, -Debug, and -ErrorAction. |
Both filtering parameters require Exchange Online PowerShell module version 3.2.0-Preview2 or later.
The -ConnectionId and -ModulePrefix parameters belong to separate parameter sets and cannot be combined in one command.
What Information Does Get-ConnectionInformation Return?
The cmdlet returns a connection object containing properties that describe the active connection, its authentication details, and its associated environment.
| Property | What it represents | Why administrators may inspect it |
|---|---|---|
ConnectionId |
Unique GUID identifying the connection | Distinguish individual connections |
State |
Connection state, such as Connected | Review reported connection status |
UserPrincipalName |
Account used to connect | Identify the connected account |
ConnectionUri |
Connection endpoint | Verify the associated service endpoint |
TokenExpiryTimeUTC |
Recorded authentication token expiration | Check token expiration timing |
TokenStatus |
Token status, such as Active | Review reported authentication status |
TenantID |
Microsoft Entra tenant GUID | Identify the associated tenant |
ModulePrefix |
Prefix assigned to imported cmdlets | Distinguish prefixed connections |
CertificateAuthentication |
Whether certificate-based authentication was used | Identify certificate-based connections |
IsEopSession |
Whether the connection is for Security & Compliance PowerShell | Distinguish connection types |
Additional documented properties include:
Id: Numeric identifier assigned within the PowerShell window.Name: Connection name, such asExchangeOnline_1.ModuleName: Path and filename of temporary session data.Organization: Organization value supplied for certificate-based or managed identity connections.DelegatedOrganization: Organization specified for delegated administration.AppId: Application ID supplied for certificate-based authentication.AzureAdAuthorizationEndpointUri: Microsoft Entra authorization endpoint.PageSize: Default maximum entries per page.ConnectionUsedForInbuiltCmdlets: Additional connection metadata.
Some properties may be empty depending on how the connection was established.
Practical Uses of Get-ConnectionInformation
1. Identifying Active Exchange Online Connections
Administrators can use Get-ConnectionInformation to identify existing REST-based connections without relying on previously executed connection commands.
The returned information includes connection identifiers, account details, and reported session states.
This is particularly useful when working with several connections in the same PowerShell instance.
2. Managing Multiple Accounts or Tenant Connections
Administrators responsible for multiple Microsoft 365 tenants may establish connections using different accounts or prefixes.
Properties such as UserPrincipalName, TenantID, ConnectionId, and ModulePrefix help distinguish these connections.
This reduces confusion when reviewing which administrative connection is associated with a particular environment.
3. Reviewing Authentication and Session Details
Get-ConnectionInformation exposes authentication-related properties, including token expiration, token status, and certificate authentication indicators.
Administrators can also inspect the connection endpoint and reported state when investigating session problems.
However, the cmdlet does not measure network latency or determine the underlying cause of every authentication failure.
Prerequisites
Before using Get-ConnectionInformation, you need:
- Exchange Online PowerShell module version 3.0.0 or later.
- An account with appropriate Exchange Online access.
- A PowerShell environment with the module installed and available.
To establish a connection, run:
Connect-ExchangeOnline -UserPrincipalName james@meetingroom365.com
Complete the authentication process when prompted.
Once connected, you can inspect the connection using Get-ConnectionInformation.
If you need to filter using -ConnectionId or -ModulePrefix, use module version 3.2.0-Preview2 or later.
Remember that the cmdlet inspects connections within the current PowerShell instance, not sessions established on other computers or by other administrators.
How to Use Get-ConnectionInformation: 6 Practical Examples
1. List All Active Exchange Online Connections
Command:
Get-ConnectionInformation
This command displays information about all active REST-based Exchange Online connections in the current PowerShell instance.
The output includes connection identifiers, account information, authentication details, and other documented properties.
Use this command as the starting point when checking which connections currently exist.
2. Display the Connected Account and Connection State
Command:
Get-ConnectionInformation |
Select-Object UserPrincipalName, State, ConnectionUri
This command displays three properties for each returned connection.
UserPrincipalName identifies the connected account, State reports the connection state, and ConnectionUri identifies the endpoint.
For example, an Exchange Online connection may display https://outlook.office365.com as its endpoint.
This is useful when verifying the account and service associated with an existing connection.
3. Check Token Expiration and Token Status
Command:
Get-ConnectionInformation |
Select-Object UserPrincipalName, TokenExpiryTimeUTC, TokenStatus
This command displays authentication token information for each connection.
TokenExpiryTimeUTC indicates when the recorded token expires, while TokenStatus reports its status, such as Active.
Administrators can use these values when investigating possible authentication expiration issues.
However, a future expiration time does not guarantee that every operation will succeed. The command also does not renew tokens or reconnect expired sessions.
4. Find a Specific Connection by ConnectionId
Command:
Get-ConnectionInformation -ConnectionId 1a9e45e8-e7ec-498f-9ac3-0504e987fa85
This command retrieves the active connection matching the specified GUID.
You can obtain a connection's GUID by running Get-ConnectionInformation without filters and examining its ConnectionIdproperty.
The ConnectionId property is different from Id:
ConnectionIdis a unique GUID for the connection.Idis a numeric identifier assigned within the PowerShell window.
You can also supply multiple GUIDs separated by commas when checking several specific connections.
5. Filter Connections by ModulePrefix
Command:
Connect-ExchangeOnline -UserPrincipalName simon@meetingroom365.com -Prefix Admin
Get-ConnectionInformation -ModulePrefix Admin
The first command establishes an Exchange Online connection with the prefix Admin.
The prefix is added to imported Exchange Online cmdlet names. For example, Get-InboundConnector becomes Get-AdminInboundConnector.
The second command retrieves connections associated with that prefix.
This is useful when administrators maintain multiple connections and want to distinguish their imported commands.
The -ModulePrefix filter is meaningful for connections established using the -Prefix parameter.
6. Inspect Authentication and Tenant Information
Command:
Get-ConnectionInformation |
Select-Object UserPrincipalName, TenantID, CertificateAuthentication, Organization, IsEopSession
This command displays authentication and organization information.
TenantID identifies the associated Microsoft Entra tenant, while CertificateAuthentication indicates whether certificate-based authentication was used.
Organization shows the organization value supplied for supported connection types, including certificate-based and managed identity connections.
IsEopSession distinguishes Exchange Online PowerShell connections (False) from Security & Compliance PowerShell connections (True).
These properties can help administrators verify authentication settings and tenant context, although not every connection will populate every property.
Get-ConnectionInformation vs. Get-PSSession
Both cmdlets provide connection-related information, but they target different PowerShell connection mechanisms.
| Cmdlet | Connection type | Main purpose |
|---|---|---|
Get-ConnectionInformation |
REST-based Exchange Online connections | Inspect current Exchange Online connection details |
Get-PSSession |
Traditional remote PowerShell sessions | List and inspect PowerShell remoting sessions |
Microsoft describes Get-ConnectionInformation as serving a comparable purpose to Get-PSSession for REST-based Exchange Online connections.
However, REST-based connections are not traditional PowerShell remoting sessions, and these commands do not return interchangeable objects.
For modern Exchange Online PowerShell administration, use Get-ConnectionInformation to inspect REST-based connection details.
Common Problems and Limitations
1. Get-ConnectionInformation Is Not Recognized
The cmdlet requires Exchange Online PowerShell module version 3.0.0 or later.
Check installed versions using:
Get-Module ExchangeOnlineManagement -ListAvailable
If necessary, update the module:
Update-Module ExchangeOnlineManagement
If the module is not installed, install it using Install-Module ExchangeOnlineManagement.
2. No Connections Are Returned
The cmdlet only reports relevant REST-based connections in the current PowerShell instance.
If no connections appear, verify that you successfully connected using Connect-ExchangeOnline in that instance.
3. ConnectionId or ModulePrefix Is Unavailable
These filtering parameters require module version 3.2.0-Preview2 or later.
An older version may support Get-ConnectionInformation without supporting these filters.
4. ConnectionId and ModulePrefix Cannot Be Combined
The parameters use separate parameter sets.
Run individual commands when you need to inspect connections by both identifiers.
5. Unexpected Account or Connection Endpoint
Inspect UserPrincipalName and ConnectionUri to identify the account and endpoint associated with the connection.
Get-ConnectionInformation does not automatically switch accounts or modify the existing connection.
6. Token Expiration Does Not Mean Automatic Reconnection
TokenExpiryTimeUTC reports the recorded token expiration time.
It does not prove that the connection is usable for every operation, and running Get-ConnectionInformation does not renew authentication.
If a connection needs to be re-established, use the appropriate connection commands.
Final Note
Get-ConnectionInformation is useful when administrators need to inspect active REST-based Exchange Online connections, identify connected accounts, review tenant and authentication details, or distinguish multiple connections.
Use it for connection inspection rather than session creation or repair.
To establish a connection, use Connect-ExchangeOnline. To terminate an Exchange Online connection, use Disconnect-ExchangeOnline.