The script establishes a connection to Microsoft Teams. The script requires the MicrosoftTeamsPowerShell module to be installed on the computer where Adaxes service runs.
PowerShell
# Get access tokens
$graphToken = $Context.CloudServices.GetAzureAuthAccessToken("https://graph.microsoft.com")
$teamsToken = $Context.CloudServices.GetAzureAuthAccessToken("48ac35b8-9aa8-4d74-927d-1f4a14a0b239")
# Connect to Microsoft Teams
try
{
Connect-MicrosoftTeams -AccessTokens @($graphToken, $teamsToken)
$team = Get-Team -DisplayName "My Team" # TODO: replace with the code you need to execute
}
finally
{
# Close the connection and release resources
Disconnect-MicrosoftTeams -Confirm:$False
}
-Assign the certificate to the Azure application whose credentials were used to register your Microsoft 365 tenant in Adaxes.
-Grant Azure application access to Microsoft Teams.
-Install the certificate on the computer where Adaxes service runs.
>-Assign the certificate to the Azure application whose credentials were used to register your Microsoft 365 tenant in Adaxes.
>-Grant Azure application access to Microsoft Teams.
>-Install the certificate on the computer where Adaxes service runs.
On the computer where Adaxes service is installed, right-click the certificate file and then click Install Certificate. Follow the instructions in the Certificate Import Wizard.
Version 2.3.2 works but non cs* commands possible.
Managing teams with Adaxes withouth interactive login seems impossible for now
> Connect-MicrosoftTeams version 2.5.0 not working anymore
Yes, that is correct and there is currently no related documentation from Microsoft.
>Version 2.3.2 works but non cs* commands possible.
Yes, the script works fine with the module version 2.3.2.
>Managing teams with Adaxes withouth interactive login seems impossible for now
That is not correct. You can specify user account credentials in the Run as section of the Run a program or PowerShell script action and then use them in your script. For details, see section Running the script as a specific user of the following SDK article: https://adaxes.com/sdk/ServerSideScripting/#running-the-script-as-a-specific-user.
Connect-MicrosoftTeams version Version 2.3.2
After the Update to Adaxes 2025.1 this is not working anymore, because Powershell 7 does not support this.
Any workarrounds to make MS Teams number and dialplan assignments with Adaxes 2025.1
Thanks
The script works just fine in Adaxes 2025.1. You only need to make sure that a version of the MicrosoftTeams PowerShell module supporting PowerShell 7 is installed on the computers where Adaxes service runs. Make sure for it to be the only version by uninstalling the rest. Unfortunately, there is no specifics in Microsoft documentation as to the versions of the module that support PowerShell 7, but we tested with version 6.9.0 and it worked without any issues.