Test-MtConnection
SYNOPSIS
Checks if the current session is connected to the specified service. Use -Verbose to see the connection status for each service.
SYNTAX
Test-MtConnection [[-Service] <String[]>] [-Details] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Tests the connection for each service and returns $true if the session is connected to the specified service.
EXAMPLES
EXAMPLE 1
Test-MtConnection -Service All
Checks if the current session is connected to all Microsoft 365 services including Azure, Microsoft Graph, Exchange Online, Exchange Online Protection (SecurityCompliance), SharePoint Online (PnP), and Microsoft Teams. Returns a Boolean value.
EXAMPLE 2
Test-MtConnection -Service All -Details
Checks if the current session is connected to all Microsoft 365 services including Azure, Microsoft Graph, Exchange Online, Exchange Online Protection (SecurityCompliance), SharePoint Online (PnP), and Microsoft Teams. Returns a custom object that contains the connection details for all services.
EXAMPLE 3
Test-MtConnection -Service Azure
Checks if the current session is connected to Azure and returns a Boolean result.
EXAMPLE 4
Test-MtConnection -Service GitHub
Checks if the current session is connected to GitHub and returns a Boolean result. Returns $false if Connect-MtGitHub has not been called in this session.
PARAMETERS
-Service
The service to check the connection for. Valid values are 'All', 'Azure', 'AzureDevOps', 'ExchangeOnline', 'GitHub', 'Graph', 'SecurityCompliance' (or 'EOP'), 'SharePointOnline', and 'Teams'. Default is 'Graph'.
GitHub requires an explicit Connect-MtGitHub call before testing; unlike other services it has no auto-detection. GitHub is not included in -Service All and must be checked explicitly.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: Graph
Accept pipeline input: False
Accept wildcard characters: False
-Details
Return the full details of all connections instead of just a boolean value.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.