Test-MtConnection
SYNOPSIS
Section titled “SYNOPSIS”Checks if the current session is connected to the specified service. Use -Verbose to see the connection status for each service.
SYNTAX
Section titled “SYNTAX”Test-MtConnection [[-Service] <String[]>] [-Details] [-ProgressAction <ActionPreference>] [<CommonParameters>]DESCRIPTION
Section titled “DESCRIPTION”Tests the connection for each service and returns $true if the session is connected to the specified service.
EXAMPLES
Section titled “EXAMPLES”EXAMPLE 1
Section titled “EXAMPLE 1”Test-MtConnection -Service AllChecks 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
Section titled “EXAMPLE 2”Test-MtConnection -DetailsReturns a connection summary for all supported services. Default services are listed first, followed by the opt-in Active Directory and GitHub services.
EXAMPLE 3
Section titled “EXAMPLE 3”Test-MtConnection -Service AzureChecks if the current session is connected to Azure and returns a Boolean result.
EXAMPLE 4
Section titled “EXAMPLE 4”Test-MtConnection -Service ActiveDirectoryChecks whether Connect-Maester -Service ActiveDirectory completed successfully in this session.
EXAMPLE 5
Section titled “EXAMPLE 5”Test-MtConnection -Service GitHubChecks 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
Section titled “PARAMETERS”-Service
Section titled “-Service”The service to check the connection for. Valid values are ‘ActiveDirectory’, ‘All’, ‘Azure’, ‘AzureDevOps’, ‘ExchangeOnline’, ‘GitHub’, ‘Graph’, ‘SecurityCompliance’ (or ‘EOP’), ‘SharePointOnline’, and ‘Teams’. The default Boolean check is for Microsoft Graph. When -Details is used without -Service, all services are checked and summarized.
Active Directory and GitHub require an explicit connection before testing; unlike other services they have no auto-detection. Active Directory is not included in -Service All. GitHub is not included in -Service All. Their current session state is included in the default -Details summary.
Type: String[]Parameter Sets: (All)Aliases:
Required: FalsePosition: 1Default value: GraphAccept pipeline input: FalseAccept wildcard characters: False-Details
Section titled “-Details”Return connection details instead of just a Boolean value. When -Service is omitted, the summary includes all default and opt-in services. Microsoft Graph details include the scopes in the current context and any required Maester scopes that are missing.
Type: SwitchParameterParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False-ProgressAction
Section titled “-ProgressAction”Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseCommonParameters
Section titled “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.