SkypeForBusiness and MicrosoftTeams powershell Module now works in Powershell 7
Manage Teams with PowerShell 7 & MacOS (maybe)
If you haven't seen the announcement yet, Microsoft teams have released version 1.1.6 of their MicrosoftTeams PowerShell module. See here. Woohoo. This module keeps getting better.
And for the good news! it works with PowerShell 7 for all that foreach parallel and optimized goodness.!!! No more waiting for thousands of changes without the batch commands.
This module now contains the New-CSOnlineSession cmdlet which means that the SkypeOnlineConnector is no longer needed. (There is a small omission we get into later )
So why the blog?
Well, when using the module (today), you will get a 404 error when trying to set up the session. For some unknown reason the logic that tries to find the Powershell endpointuri is not working.
By running
$Session = new-csonlinesession -verbose
you can see the client going through device authentication and fail at discovering the URI
So, we need to tell the module how to find the admin uri. fortunately the devs at Microsoft gave us a parameter we can call to help.
$Session = new-csonlinesession -OverrideAdminDomain "<DOMAIN>.onmicrosoft.com" -OverridePowerShellUri "https://admin0e.online.lync.com/OcsPowershellLiveId"
The key bit of the above command is to ensure you declare your onmicrosoft.com account and ensure the admin0e bit above matches your tennant. To get your host visit the below page changing your tenant to your own
https://lyncdiscover.<TENANT>.onmicrosoft.com/?Domain=<TENANT>.onmicrosoft.com
You will get a webpage back with a webdir address referenced as the redirect. or use this command
(iwr http://lyncdiscover.<TENANT>.onmicrosoft.com/?Domain=<TENANT>.onmicrosoft.com).rawcontent.split('"redirect":{"href":"https://')[1].split('.')[0]
change webdir to admin and add .online.lync.com/OcsPowershellLiveId, then boom you have your powershell endpointuri.
I assume Microsoft will fix this bug in the next release, but in the meantime this is a quick and dirty way to manage your Microsoft Teams / SfB online from Powershell 7.
In the near future, I will look to create a small script which will help make this process a little slicker.
The bug. Enable-CsOnlineSessionForReconnection is not available in this version, not sure why the omission, but as soon as i hear more I will update.
Have fun coding people.
Comments
Post a Comment
No Spam Please