Unable to connect to Teams with Powershell Module V2.0.0 in docker

Hano Botha 96 Reputation points
2021-03-05T07:28:25.663+00:00

I can connect to Teams with the Powershell V2.0.0 module installed using snapd on Ubuntu v19.10 and Ubuntu 20.04.2 LTS:
74645-connectedtoteams.png

I can install the MicrosoftTeams module using the official powershell image on Docker, but when I try to do Get-CsOnlineUser, I get an error:
74683-teamserror.png

In Text:

ParentContainsErrorRecordException: /root/.local/share/powershell/Modules/MicrosoftTeams/2.0.0/netcoreapp2.1/SfBORemotePowershellModule.psm1:9474

Line |

9474 | $steppablePipeline = $scriptCmd.GetSteppablePipeline($myI …

 |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

 | Exception calling "GetSteppablePipeline" with "1" argument(s): "Exception calling "GetRemoteNewCsOnlineSession" with "1" argument(s): "This parameter set requires WSMan, and no supported WSMan  

 | client library was found. WSMan is either not installed or unavailable for this system.""  

Docker file:

from mcr.microsoft.com/powershell

RUN /opt/microsoft/powershell/7/pwsh -command "Set-PSRepository -InstallationPolicy Trusted -Name PSGallery"

RUN /opt/microsoft/powershell/7/pwsh -command "Install-Module -Name MicrosoftTeams -AllowPrerelease -Force -AllowClobber"

CMD ["pwsh"]

Script to execute:

$teams_username = 'XXXXXXXXX.onmicrosoft.com'

$pword = ConvertTo-SecureString -String 'XXXXXXXXX' -AsPlainText -Force

$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $teams_username, $pword

Connect-MicrosoftTeams -Credential:$credential

Get-CsOnlineUser -ResultSize 10 | fl SamAccountName

Skype for Business Linux
Skype for Business Linux
Skype for Business: A Microsoft communications service that provides communications capabilities across presence, instant messaging, audio/video calling, and an online meeting experience that includes audio, video, and web conferencing.Linux: A family of open-source Unix-like operating systems.
456 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hano Botha 96 Reputation points
    2021-03-05T12:39:23.09+00:00

    I found this article very useful:
    https://github.com/PowerShell/PowerShell-Docker/issues/534

    The final solutio was to install WSMan on my docker image


0 additional answers

Sort by: Most helpful