# Connecting to Teams PowerShell environment

**Category:** Teams KB
**URL:** https://www.simtex.com.au/support/kb/teams-kb/connecting-to-teams-powershell-environment
**Published:** 2021-04-12

Many administration tasks for Teams require the use of PowerShell.  To connect to the Teams environment via PowerShell, do the following:

Many administration tasks for Teams require the use of PowerShell.  To connect to the Teams environment via PowerShell, do the following:

1. Launch an elevated (administrator) PowerShell console by clicking **Start**, typing **PowerShell**, *right-click* and select **Run As Administrator
[![](https://www.simtex.com.au/uploads/teams7_300x239_c9aedd3394.png)](https://www.simtex.com.au/wp-content/uploads/2020/04/teams7.png)
**

2. If this is the first time you’re doing this, you must install the Teams module:

```
Install-Module MicrosoftTeams
```

3. Sign in using modern authentication (must have MFA)
Replace <UPN> with a username@domain with administrator access

```
#Connect to Microsoft Teams 
Connect-MicrosoftTeams -AccountId <UPN> 

#Connection to Skype for Business Online and import into Ps session 
$session = New-CsOnlineSession 
Import-PsSession $session
```

**Tags:** powershell, teams

## Related

- Article: https://www.simtex.com.au/support/kb/teams-kb/connecting-to-teams-powershell-environment
- Category: https://www.simtex.com.au/support/kb/teams-kb
- Knowledge Base: https://www.simtex.com.au/support/kb
- Full AI reference: https://www.simtex.com.au/llms-full.txt
