# Test-MtConnection

Checks if the current session is connected to the specified service.

Source: https://maester.dev/docs/commands/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

```powershell
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

```powershell
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

```powershell
Test-MtConnection -Details
```

Returns a connection summary for all supported services.
Default services are listed first, followed by the opt-in Active Directory and GitHub services.

### EXAMPLE 3

```powershell
Test-MtConnection -Service Azure
```

Checks if the current session is connected to Azure and returns a Boolean result.

### EXAMPLE 4

```powershell
Test-MtConnection -Service ActiveDirectory
```

Checks whether Connect-Maester -Service ActiveDirectory completed successfully in this session.

### EXAMPLE 5

```powershell
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 'ActiveDirectory', 'All', 'Azure', 'AzureDevOps', 'ExchangeOnline', 'GitHub', 'Graph', 'SecurityCompliance' (or 'EOP'), 'SharePointOnline', and 'Teams', and the service of an installed Maester Pack's connector, such as CNT.GoogleWorkspace (Get-MtConnector lists them).
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.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: Graph
Accept pipeline input: False
Accept wildcard characters: False
```

### -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.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -ProgressAction

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

```yaml
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### System.Boolean

## NOTES

## RELATED LINKS

[https://maester.dev/docs/commands/Test-MtConnection](https://maester.dev/docs/commands/Test-MtConnection)
