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:
-
Login to https://shell.azure.com
-
Within the PowerShell prompt enter
Connect-MicrosoftTeams -Identity
-
Run a Teams PowerShell command
“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:
-
Authenicate with the Teams PowerShell module using a device code
Connect-MicrosoftTeams -UseDeviceAuthentication
-
Once signed in, you can now use Cs cmdlets