0 votes

Hi, we are using Adaxes version 3.14.18920.0.

We have Teams Poweshell module 2.3.1 installed on the computer where adaxes service runs.

We have the certificate thumbprint from the certificte installed on the same machine, replaced with 'XXX' in the script.

The error I am receiving is,

"A parameter cannot be founf that matches parameter name 'CertificateThumbprint'. Stack trace: at <Scriptblock.,<No File>: line 9"

This is the script I am trying to run -

----------------------------
$certificateThumbprint = "XXXXXXXX" # TODO: modify me

# Connect to Microsoft Teams
$tenant = $Context.CloudServices.GetO365Tenant()
$credential = $tenant.GetCredential()

try
{
    Connect-MicrosoftTeams -TenantId $tenant.TenantId -CertificateThumbprint $certificateThumbprint -applicationid $credential.AppId

    Set-CsUser -Identity %firstname%.%lastname%@example.com -OnPremLineURI $NULL -EnterpriseVoiceEnabled $true -HostedVoiceMail $true 

    Grant-CsOnlineVoiceRoutingPolicy -Identity %firstname%.%lastname%@example.com -PolicyName "No Restrictions" 
}    
finally
{
    # Close the connection and release resources
    Disconnect-MicrosoftTeams -Confirm:$False
}
by (140 points)
edited by

1 Answer

+1 vote
by (294k points)

Hello,

As per our check, the script is correct and should work just fine. It looks like there are some issues with the teams PowerShell module installed. We recommend you to make sure that there is only one version of the module installed. If this does not resolve the issue, we recommend you to contact Microsoft support. Per their documentation the CertificateThumbprint parameter is available for the Connect-MicrosoftTeams cmdlet and the parameter name in your script is correct.

0

Okay, so I uninstalled all versions of the Teams Module installed on this machine and now I have only Teams 2.3.1 (current version)

The script throws a new message this time, Teams Error.PNG

$certificateThumbprint = "XxxxxxX" # TODO: modify me

# Connect to Microsoft Teams
$tenant = $Context.CloudServices.GetO365Tenant()
$credential = $tenant.GetCredential()

try
{
    Connect-MicrosoftTeams -TenantId $tenant.TenantId -CertificateThumbprint $certificateThumbprint -applicationid $credential.AppId
    Set-CsUser -Identity %firstname%.%lastname%@example.com -OnPremLineURI tel:+1XXXXXXXXXX -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
    Grant-CsOnlineVoiceRoutingPolicy -Identity %firstname%.%lastname%@example.com -PolicyName "No Restrictions"
}    
finally
{
    # Close the connection and release resources
    Disconnect-MicrosoftTeams -Confirm:$False
}
+1

Hello,

Unfortunately, we were not able to find any information related to the error you are facing. Most probably, there are some issues when connecting to Microsoft Teams with Azure application details or executing cmdlets. Could you, please, try connecting to Microsoft Teams in Windows PowerShell? Does it work fine?

As an option, you can try connect to Microsoft teams using the Connect-MicrosoftTeams cmdlet and the credentials explicitly specified in the Run As section of the Run a program or PowerShell script action. In this case, the script will be like below:

# Get saved credentials.
$username = $Context.RunAs.UserName
$password = $Context.RunAs.Password | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PsCredential($username, $password)

try
{
    Connect-MicrosoftTeams -Credential $credential
    Set-CsUser -Identity %firstname%.%lastname%@example.com -OnPremLineURI tel:+1XXXXXXXXXX -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
    Grant-CsOnlineVoiceRoutingPolicy -Identity %firstname%.%lastname%@example.com -PolicyName "No Restrictions"
}    
finally
{
    # Close the connection and release resources
    Disconnect-MicrosoftTeams -Confirm:$False
}
0

Hi, thank you for this suggestion. This works!

Related questions

+1 vote
1 answer

I am trying to connect to teams via powershell in adaxes to run the following commands. Set-CsUser -Identity &lt;UPN&gt; -EnterpriseVoiceEnabled $true -HostedVoiceMail $true ... (policyname)" I am not able to run the following though, Connect-MicrosoftTeams

asked Apr 22, 2021 by TJ_Umredkar (140 points)
+1 vote
1 answer

Hi all, Just wondering how I would go about connecting to Teams using Adaxes? I need to perform the following modifications to users: Set-CsUser -Identity &lt;UPN&gt ... make Adaxes connect to Teams using the Connect-Microsoftteams command and run the above?

asked Feb 24, 2021 by TheLexicon (200 points)
0 votes
1 answer

Hi, We've recently started seeing users get 'Unable to connect to nearest Adaxes service' errors when accessing the Adaxes web portal. It's far too vague\random to have an idea ... last night to see if that fixed it, but we have had the issue again today.

asked Dec 13, 2013 by firegoblin (1.6k points)
0 votes
1 answer

Dear Support, can you please advise how to properly troubleshoot Connect-MSOlService? I have x64 Adaxes installation I have this function properly working in Powershell ISE and ... Directory Module for Wind... Powershell version 5.1 Thanks for any advise!

asked Jul 5, 2019 by Dmytro.Rudyi (920 points)
0 votes
1 answer

Dear Adaxes, is it possible automate the process of adding a user to a teams channel that is private upon user creation. example running a powershell script? is this doable with the latest version?

asked Aug 16, 2023 by fxg (20 points)
3,588 questions
3,277 answers
8,303 comments
548,091 users