Introduction
After installing the Teams module as per the instructions from the Microsoft Documentation, when running the command Get-Team after connecting to Teams Admin using the command
Connect-MicrosoftTeams, I am getting the following error
Initially, I got stumbled on why I was getting this. I did the install correctly, and as you observe in the screenshot, I have used the variable $TeamsConnection, initialized with connect-MicrosoftTeams, and checked the output, whether my connection is successful or not.
Everything looks correct. After this, I tried with the MailNickName property and got the same issue.
Fix
After some internet research, I learned that there is another module in the loaded PowerShell modules conflicting with the MicrosoftTeams PowerShell modules methods. In this case, when I tried to see the get-module I could see the ShareGate module is also loaded, which is the culprit.
When ShareGate Module gets loaded together with the MicrosoftTeams PowerShell module, the Get-Team command seems to be failing. When removing the module from the current sessions, the Get-Team command seems to work fine.
Conclusion
Thus, in this blog you have seen the error why Teams PowerShell commands are failing even though the PS module loaded successfully, and the fix to remediate the issue.
References
https://learn.microsoft.com/en-us/microsoftteams/teams-powershell-install