Open mariussm opened 3 years ago
I get a similar issue. I am trying to use MicrosoftTeams cmdlet in an Azure Function v3 (http trigger), with PowerShell v7.
I am able to login with Connect-MicrosoftTeams -Credential $cred
.
When trying to use some old skypeonlineconnector
cmdlets (for example, Get-CsOnlineUser
), I do have the same exception :
Exception calling "GetSteppablePipeline" with "1" argument(s): "Object reference not set to an instance of an object."
It does work for "classical" cmdlet, for example Get-Team
...
Works in a local environment. I also tried by installing the MicrosoftTeams modules directly in the Modules folder.
Connect-MicrosoftTeams -Credential $cred
#Raise an exception
try {
$user = Get-CsOnlineUser -Identity "herve.losse@###.onmicrosoft.com" -ErrorAction Stop
}
catch {
Write-Host $_.Exception.Message
}
#Works
try {
$teams = Get-Team -ErrorAction Stop
}
catch {
Write-Host $_.Exception.Message
}
@{
'MicrosoftTeams' = '2.0.0'
}
I have the same issue with the current stable 2.0 version. I experimented with the unstable 2.1 version and it seems to work. My requirements.psd1:
@{
'Az' = '5.*'
'MicrosoftTeams' = '2.1.0-preview'
}
Not sure if the Az
module is necessary for Teams only, but I have some other commands in the script that requires it and maybe this has also a side effect on the MicrosoftTeams
module.
I just tried with the 2.1.0-preview MicrosoftTeams module, it seems to work also.
Not sure if the
Az
module is necessary for Teams only, but I have some other commands in the script that requires it and maybe this has also a side effect on theMicrosoftTeams
module.
I don't have the 'Az' module installed, so only the package itself seems to be enough.
I suppose we have now to wait for a stable package !
Hello @tameemansari and @brandber -- Do you know if the issues above are fixed in the latest version of the MicrosoftTeams module (https://www.powershellgallery.com/packages/MicrosoftTeams/2.4.0-preview).
Trying to use the MicrosoftTeams PowerShell module version 2.0.0 as a managed dependency causes Connect-MicrosoftTeams to error out with the following error message, with chinese characters:
This happens only when loading the module without the -UseWindowsPowerShell parameter for Import-Module:
PowerShell example
requirements.psd1
When using the -UseWindowsPowerShell parameter, I experience my function as unstable, often failing.
I have also tried Save-Module and having the module as files, loading it from there rather than managed dependency. Same issue.
This is a durable PowerShell 7 function.
Edit: Forgot to add the fact that everything works perfectly when running the function runtime locally.