I'm having a hard time connecting to Microsoft Teams with Microsoft Orchestrator 2016. When I run my powershell code with RunbookTester, the code ends successfully. However, when I use another platform to test the same runbook, there is always a problem with the connection. I've checked and the module is well instled and imported. Here is my code:
$User = "xxx@contoso.com"
$PassWord = ConvertTo-SecureString -String "YourPassword" -AsPlainText -Force
$UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PassWord
Connect-MicrosoftTeams -Credential $UserCredential
The errors occurs in the last command, with the credentials, which is strange because this does not happen when I run the runbook with runbookTester. I've done some research and found this command:
Set-ExecutionPolicy RemoteSigned
I'm not sure what this command does and if it will solve my problem. Has someone has the same problem? How can I fix this?