Forum Discussion
c# and MicrosoftTeams PowerShell Modul 3.1.0
- Feb 07, 2022
joergsc_4711 - The engineering team has ran command in C# for a test tenant with MFA enabled and it is working fine in version 3.1.1. Sharing the script and the output.
Script :
Output :
Can you please update version and try again? And if failing again please share the complete screenshot of error and script?
We got an update from the engineering team saying -
MFA is supported only with interactive option, Please refer - https://docs.microsoft.com/en-us/powershell/module/teams/connect-microsoftteams?view=teams-ps
Thanks,
Meghana
---------------------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
When you connect to Azure AD or Exchange with an MFA enabled account, the interactive Logon Windows pops up and you can log on interactively (same behavior in ISE and C#). When you do the same with Teams, PowerShell throws the error mentioned above. So the behavior of the Teams Modul is not consistent with AAD or Exchange.
By the way: if you issue the command in ISE directly, it works even with Teams. If you issue the same command via C#, it doesn't work.
- Meghana-MSFTFeb 07, 2022Former Employee
joergsc_4711 - The engineering team has ran command in C# for a test tenant with MFA enabled and it is working fine in version 3.1.1. Sharing the script and the output.
Script :
Output :
Can you please update version and try again? And if failing again please share the complete screenshot of error and script?
- joergsc_4711Feb 07, 2022Copper ContributorMeghana-MSFT - YES. That works. The difference is the -AccountId Parameter.
My original statement was ...AddCommand("Connect.MicrosoftTeams -AccountId Email address removed")
Then PowerShell returns with error: "Broker response returned error: WAM Error Wam plugin Microsoft.Identity.Client.Platforms.Features.WamBroker.AadPlugin Error code: 3399548929 Error Message: Need user interaction to continue."
If you omit the -AccountId Parameter, it works.
This is different from AzureAd Modul. There you can specify the -AccountId Parameter to prepopulate the interactive MFA Login Window.
Without your screenshot it would have taken ages to find this.
So: many thanks!!- Meghana-MSFTFeb 08, 2022Former Employee
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.