Use the Teams PowerShell Module in Azure Shell

A neat little trick I came across recently was that you can connect to a Teams PowerShell session within the Azure Shell. Even better, you do not need to install or import the module, or even enter your credentials (thanks Managed Identity)! Simply do the following:

  1. Login to
  2. Within the PowerShell prompt enterConnect-MicrosoftTeams -Identity
  3. Run a Teams PowerShell commandimage

“Cs” Cmdlets

Cs cmdlets (e.g. Get-CsApplicationAccessPolicy) do NOT currently work with the above method and return an error. However, there is a workaround:

  1. Authenicate with the Teams PowerShell module using a device codeConnect-MicrosoftTeams -UseDeviceAuthentication
  2. Once signed in, you can now use Cs cmdletsimage

This blog post is part of Microsoft Teams Week. Find more great blogs here.

About the Author:

Hi – I’m Lee.

I’m a Microsoft MVP (Office Development) and Solution Architect for Symity based in Birmingham, UK. I predominantly work with Microsoft Teams but also work with other technologies such as Azure, PowerShell, Power Platform, and Microsoft 365.

You can follow me on Twitter at @lee_ford


Ford, L. (2021). Use the Teams PowerShell Module in Azure Shell. Available at: [Accessed: 2nd December 2021].

Share this on...

Rate this Post: