Connect-MicrosoftTeams

Note: This cmdlet is currently in Beta.

The Connect-MicrosoftTeams cmdlet connects an authenticated account to use for Microsoft Teams cmdlet requests. You can use this authenticated account only with Microsoft Teams cmdlets.

Syntax

Connect-MicrosoftTeams
       [-TenantId <String>]
       [-Credential <PSCredential>]
       [-AccountId <String>]
       [-LogLevel <LogLevel>]
       [-LogFilePath <String>]
       [-WhatIf]
       [-Confirm]
Connect-MicrosoftTeams
       -TenantId <String>
       -CertificateThumbprint <String>
       -ApplicationId <String>
       [-LogLevel <LogLevel>]
       [-LogFilePath <String>]
       [-WhatIf]
       [-Confirm]
Connect-MicrosoftTeams
       [-TenantId <String>]
       -AadAccessToken <String>
       [-MsAccessToken <String>]
       -AccountId <String>
       [-LogLevel <LogLevel>]
       [-LogFilePath <String>]
       [-WhatIf]
       [-Confirm]

Required Parameters

-ApplicationId

Specifies the application ID of the service principal.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-CertificateThumbprint

Specifies the certificate thumbprint of a digital public key X.509 certificate of a user account that has permission to perform this action.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams

Optional Parameters

-AadAccessToken

Specifies a Azure Active Directory Graph access token.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-AccountId

Specifies the ID of an account. You must specify the UPN of the user when authenticating with a user access token.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-Credential

Specifies a PSCredential object. For more information about the PSCredential object, type Get-Help Get-Credential.

The PSCredential object provides the user ID and password for organizational ID credentials.

Type:PSCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-LogFilePath

The path where the log file for this PowerShell session is written to. Provide a value here if you need to deviate from the default PowerShell log file location.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-LogLevel

Specifies the log level. The acceptable values for this parameter are:

  • Info
  • Error
  • Warning
  • None

The default value is Info.

Type:LogLevel
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-MsAccessToken

Specifies a Microsoft Graph access token.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-TenantId

Specifies the ID of a tenant.

If you do not specify this parameter, the account is authenticated with the home tenant.

You must specify the TenantId parameter to authenticate as a service principal or when using Microsoft account.

Type:String
Aliases:Domain, TenantDomain
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Microsoft Teams

Notes

Tips for troubleshooting:

  1. Confirm SAML 2.0 is being used. IDP is outputting invalid SAML information. Needs to have SAML 2.0 vs. SAML 1.0 for the module to connect. You might experience an error if the Identity Provider (IDP) only allows the use of SAML1.0 when trying to auth via basic authentication. Which in turn, isn't expected to work because the cmdlet expects either OAUTH2 (which is used when doing just connect-microsofteams), or SAML2.0.
  2. Confirm you have the latest version of the cmdlet. You can find the version by running: get-module -listavailable and then looking for the MicrosoftTeams name and the version to the left of it.