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 https://shell.azure.com

  2. Within the PowerShell prompt enter

    Connect-MicrosoftTeams -Identity
    
  3. Run a Teams PowerShell command

    image

“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 code

    Connect-MicrosoftTeams -UseDeviceAuthentication
    
  2. Once signed in, you can now use Cs cmdlets

    image