Set-TeamsEnvironmentConfig

Sets environment-specific configurations on the local machine and is used to connect to the right environment when running Connect-MicrosoftTeams.

Syntax

Set-TeamsEnvironmentConfig
   [-EndpointUris <Hashtable>]
   [-TeamsEnvironmentName <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

This cmdlet sets environment-specific configurations like endpoint URIs(such as Microsoft Entra ID and Microsoft Graph) and Teams environment (such as GCCH and DOD) on the local machine.

When running Connect-MicrosoftTeams, environment-specific information set in this cmdlet will be considered unless overridden by Connect-MicrosoftTeams parameters.

Parameters passed to Connect-MicrosoftTeams will take precedence over the information set by this cmdlet.

Clear-TeamsEnvironmentConfig should not be used in Commercial, GCC, GCC High, or DoD environments.

Examples

Example 1

PS C:\> Set-TeamsEnvironmentConfig -TeamsEnvironmentName TeamsChina

Sets the environment as Gallatin China on a local machine and when Connect-MicrosoftTeams is run, authentication will happen in the Gallatin China cloud and Microsoft Teams module will connect to the Gallatin environment.

Example 2

$endPointUriDict = @{ActiveDirectory = 'https://login.microsoftonline.us/';MsGraphEndpointResourceId = 'https://graph.microsoft.us'}
Set-TeamsEnvironmentConfig -TeamsEnvironmentName $endPointUriDict

Sets endpoint URIs required for special clouds.

Example 3

Set-TeamsEnvironmentConfig -TeamsEnvironmentName TeamsChina

$cred=get-credential
Move-CsUser -Identity "PilarA@contoso.com" -Target "sipfed.online.lync.com" -Credential $cred

This cmdlet is mainly introduced to support Skype for Business to Microsoft Teams user migration using Move-CsUser.

This example shows how tenant admins can run Move-CsUser in Gallatin and other special clouds after setting the environment configuration using Set-TeamsEnvironmentConfig.

Note that Set-TeamsEnvironmentConfig needs to be run only once for each machine. There is no need to run it each time before running Move-CsUser.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EndpointUris

Provides custom endpoints.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TeamsEnvironmentName

Provides a Teams environment to connect to, for example, Teams GCCH or Teams DoD.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.Object

Notes

Set-TeamsEnvironmentConfig should not be used in Commercial, GCC, GCC High, or DoD environments.