Office-docs-powershell: Connect-MicrosoftTeams error in Azure function

Created on 19 Jun 2020  路  18Comments  路  Source: MicrosoftDocs/office-docs-powershell

Getting the error below when using the MicrosoftTeams PowerShell module v1.0.22 in an Azure function and trying to call the connect-microsoftteams commandlet and passing in the credential object.

[Error] ERROR: Connect-MicrosoftTeams : password_required_for_managed_user: Password is required for managed user

Version 1.0.22 of the module is required to take advantage of the CsGroupPolicyAssignment commandlets

teams

All 18 comments

I notice that the connect-microsoftteams contains an identity parameter which although there is no documentation related to the parameter presumably it infers the ability to use a managed identity? Is anyone able to elaborate if its possible to use a managed identity when using the the connect-microsoftteams commandlet and if assigning the identity to a built-in role like teams service admin will solve my issue? Thanks in advance

@officedocsbot assign @yogkumgit

Hello @azureDev20
Please see the following https://github.com/MicrosoftDocs/office-docs-powershell/issues/5177#issuecomment-611114041
where someone from the team confirmed that they are currently working with -Identity parameter for future releases, the documentation does not reflect it because it is not ready to be used yet. (and also, module 1.0.22 is from the beta channel)

Hope this information helps you.

Thanks @get-itips I expected as much but thought I would ask so thanks for clarifying. Any information on how to use the connect-microsoftteams commandlet in an Azure function to successfully authenticate would be greatly appreciated.

@azureDev20
Are you using the cmdlet as described in the documentation? for example, passing a credential object to the credential parameter.

@get-itips see below script which is executed on the PowerShell runspace of an Azure function to access ms teams instance

Import-module "D:\home\site\wwwroot\TestFunction\msteams\1.0.22\MicrosoftTeams.psd1"

$Username = $ENV:SvcAcctUsername
$P = $ENV:SvcAcctPwd
$Password = $P | ConvertTo-SecureString -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential($Username, $Password)

Connect-MicrosoftTeams -Credential $Credential

Error - [Error] ERROR: Connect-MicrosoftTeams : password_required_for_managed_user: Password is required for managed user

Script above works when run on-prem

@azureDev20 I am not an expert in Azure Functions, however, I received the same error trying to run the cmdlet under PowerShell Core, and Microsoft Teams PowerShell module is currently only compatible with Windows PowerShell, can you confirm you are using Windows PowerShell?

thanks @get-itips, at this time the only PowerShell runtime stack available in an Azure function is PowerShell core so that would explain the issue. Thanks for your continued assistance.

Thanks for returning and sharing that feedback!

No worries, I just checked the PowerShell Gallery website and it states that the MS Teams module is for both Windows PowerShell and PowerShell core, see URL below. Can you send me the URL which states that the module is only available to Windows PowerShell?

https://www.powershellgallery.com/packages/MicrosoftTeams/1.0.7

No worries, I just checked the PowerShell Gallery website and it states that the MS Teams module is for both Windows PowerShell and PowerShell core, see URL below. Can you send me the URL which states that the module is only available to Windows PowerShell?

https://www.powershellgallery.com/packages/MicrosoftTeams/1.0.7

I see that information was added recently, will try to cross check with the product team.

@azureDev20 Managed to report this behavior in Ps Core to the product team, they are aware and can work on it. Thanks!

Excellent, thanks @get-itips looking forward to a good outcome.

@get-itips Thank you very much for the contribution and sharing this explanation. @azureDev20 Hope this comment is helpful for you. If you see a documentation update is required, please feel free to open an issue for the same. We proceed here to close it. Thanks for taking out some time to open the issue. Appreciate and encourage you to do the same in future also.

@get-itips Is there any timeline from the product team on when this will be fixed?

@get-itips Is there any timeline from the product team on when this will be fixed?

How are you? I am afraid not, I will reply to this thread (will remain closed as this is not a documentation issue) once I get an update.

Good thank you, it seems a pretty huge bug for it not to be worked on as a matter of priority as this exists on all the Microsoft PowerShell modules I have tested including the modules in GA. Is there another area in Github I can report this bug on?

Good thank you, it seems a pretty huge bug for it not to be worked on as a matter of priority as this exists on all the Microsoft PowerShell modules I have tested including the modules in GA. Is there another area in Github I can report this bug on?

There isn't, however, I have confirmation is already filed and triaged internally. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LindaSchaar picture LindaSchaar  路  4Comments

savusca picture savusca  路  4Comments

KoenZomers picture KoenZomers  路  3Comments

CallMeByMyName picture CallMeByMyName  路  5Comments

andikrueger picture andikrueger  路  5Comments