Microsoft Teams PowerShell Cmdlets – Serendipitous arrival!

Microsoft Teams PowerShell cmdlets

I’m working with a client currently that wants to be able to control the creation of groups, using their existing provisioning system to trigger a PowerShell script for the creation after an internal approval workflow is executed. Whilst this worked fine for the creation of Office 365 groups, what it didn’t allow for was the creation of Microsoft Teams. I spent most of Thursday this week looking at utilising the Microsoft Graph to achieve what was required and then as if by magic, Microsoft dropped the announcement that the Beta version of the PowerShell module for Microsoft Teams was available!

https://www.powershellgallery.com/profiles/MicrosoftTeams/

Nice and simple to install, this gives quick access to a small number of cmdlets that give you instant PowerShell control over your Microsoft Teams! And it couldn’t have come at a better time. Once you’ve installed the module following the documentation provided in the repository, it’s simple to connect to your tenant using “Connect-MicrosoftTeams” and logging in using an Admin account.

The following cmdlets are now available to you:-

 

Connect-MicrosoftTeams Connects to the Microsoft Teams endpoint for your tenant.
Disconnect-MicrosoftTeams Disconnects from the Microsoft Teams endpoint.
Get-Team This cmdlet gets all of the teams that the current user is a member of. Whilst there is a –user property, it doesn’t work currently when you provide another user identity, returning an error stating:

”This request is only supported in current user context only”

Likewise as an Admin, it currently only provides a list of the teams that the admin user is a member of. I would expect an admin version of this cmdlet in a future release as it’s a fundamental use case.

Get_TeamChannel I expect this cmdlet to return a list of channels for a given GroupID parameter. If you execute Get-TeamChannel, you are prompted for a GroupID. Currently however the cmdlet returns an error: “Resource not found for the segment ‘channels’
Get-TeamFunSettings Returns the following settings for a given GroupID

  • AllowGiphy
  • GiphyContentRating
  • AllowStickersAndMemes
  • AllowCustomMemes
Get-TeamGuestSettings Returns the following settings for a given GroupID

  • AllowCreateUpdateChannels
  • AllowDeleteChannels
Get-TeamHelp Returns a list of Teams cmdlets.
Get-TeamMemberSettings Returns the following settings for a given GroupID

  • AllowCreateUpdateChannels
  • AllowDeleteChannels
  • AllowAddRemoveApps
  • AllowCreateUpdateRemoveTabs
  • AllowCcreateUpdateRemoveConnectors
Get-TeamMessagingSettings Returns the following settings for a given GroupID

  • AllowUserEditMessages
  • AllowUserDeleteMessages
  • AllowOwnerDeleteMessages
  • AllowTeamMentions
  • AllowChannelMentions
Get-TeamUser Gets a list of users for the given GroupID.

Returns a list of user objects containing UserID, Username, display name, and role.

Add-TeamUser Adds a user to the given Team using their FQDN.
New-Team Creates a new team, allows the passing of several parameters to control Display name, description,alias and adding the creator as a member. Returns the GroupID.
New-TeamChannel Creates a new channel within a team for the given group ID. Allows the passing of channel name and description.

Currently fails with the same error as Get-TeamChannel.

Remove-Team
Remove-TeamChannel Removes the specified channel name from the given GroupID.

Currently fails withy the same error as Get-TeamChannel.

Remove-TeamUser Removes the given Username (FQDN) from the given GroupID team.
Set-Team Allows the updating of key parameters for a given GroupID.

  • DisplayName
  • Description
  • Alias
  • Classification
  • AccessType
Set-TeamChannel Allows the updating of key parameters for a given channels current display name and GroupID

  • NewDisplayName
  • Description

Currently fails with the same error as other channel cmdlets.

Set-TeamFunSettings Allows the setting of the Fun settings show with the Get version of this cmdlet.
Set-TeamGuestSettings Allows the setting of the Guest settings show with the Get version of this cmdlet.
Set-TeamMemberSettings Allows the setting of the Member settings show with the Get version of this cmdlet.
Set-TeamMessagingSettings Allows the setting of the Messaging settings show with the Get version of this cmdlet.
Set-TeamPicture Allows the upload of a new image for the given GroupID from a local path.

Changes can take up to an hour to be reflected in clients.

As you can see, it’s a fairly comprehensive list of cmdlets initially which complement the current settings available in the UI to Team owners. One which particularly interests me is the ability to control the Message settings as it would appear that the default settings on a tenant are NOT currently reflected in the tenant during Team Creation. I think this is expected behaviour as the tenant settings in the Admin Portal control the ability for an Owner to set them, rather than the default setting. ideally I’d like to see this updated to include a default option too. (I’ll probably look at adding a User Voice request for this.)

To see what I mean, look at the image below:-

Microsoft Teams tenant permissions versus team permissions

The image on the left is the configuration options in the Admin Portal, the member permissions on the right is the default settings for a newly created Team. You can see that by default the ability to delete and edit messages is turned off, despite the Admin portal setting show this as on. If however you turn the Admin portal option to off, the option to configure Edit and Delete is removed entirely.

Microsoft Teams permissions with Tenant level applied

And the user cannot do either:-

User options in restricted Teams team

I was hoping that the cmdlets would then let me turn on Edit and Delete for a given channel, but unfortunately it would appear that if the global setting is turned off, the PowerShell does not override this setting (even using an Admin account) and the user still cannot edit or delete, despite the get-teammessagingsettings returning a TRUE value for both.

image

I’ll be testing further over the coming weeks and will update this post as things change.

 

Paul.

2 comments

    • Daniel Westerdale on Mon 6 Nov 17 at 9:31 am
    • Reply

    Well spotted paul, a lot of us are waiting for these.

  1. Thanks for this Paul – I’m looking out for cmdlets to support the adding of Chatbots/Tabs to Teams – when we get that I will be happy 🙂

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.