HomeAbout Me
Microsoft 365
Manage Microsoft Teams Templates with PowerShell
Simon Ågren
Simon Ågren
February 14, 2022
2 min

Table Of Contents

01
Prerequisites
02
The Microsoft Teams PowerShell Module
03
Get all Teams Templates
04
What can we do with the template in PowerShell then?
05
Scenario: Updating what members can do in Teams
06
Creating a new template
07
Summary
Manage Microsoft Teams Templates with PowerShell

As stated in a previous post, you can manage only a few settings regarding Teams Templates from the UI. Instead, we could use PowerShell to update template settings after creation or create a template with the preferred settings from the get-go. PowerShell is also helpful to copy a template and create a new one, for instance, in multilingual scenarios with different locales.

Prerequisites

Install the Microsoft Teams PowerShell Module and then connect to the Teams Admin center

Install-Module -Name MicrosoftTeams
Connect-MicrosoftTeams

The Microsoft Teams PowerShell Module

You can read more about the MicrosoftTeamsPowerShell Module over at Microsoft Docs

You could use the following cmdlets to manage your templates in PowerShell.

  • Get-CsTeamTemplate
  • Get-CsTeamTemplateList
  • New-CsTeamTemplate
  • Remove-CsTeamTemplate
  • Update-CsTeamTemplate

Get all Teams Templates

Using the command as is, prints all OdataId*. If you want to see some more properties, you could pipe Format-List** at the end.

Get-CsTeamTemplateList | Format-List

Formated list of all Teams templates
Formated list of all Teams templates

What can we do with the template in PowerShell then?

The edit settings from the UI are as limited as to when we created the template. For example, we could change the name, short and long description, modify channels and apps.

Limited settings from te UI
Limited settings from te UI

We can change all of the above via PowerShell and also:

  • Team visibility (public or private)
  • Team settings (for example, member, guest, @ mentions)

Scenario: Updating what members can do in Teams

Depending on your organization’s requirements, you might want to limit what team members can do. For example, we could leave the channel management to team owners and disable the option for members. This way, members are not hindered and can still be productive. Without teams templates or any other custom solutions, every team would have to be changed manually from the Team Settings. Let’s change the template to disable channel management for members. First, get the template and output it to a .json file.

(Get-CsTeamTemplate -OdataId "/api/teamtemplates/v1.0/a4e03348-39cd-42c7-9035-8c4439b55a21/Tenant/en-US") > input.json

Open the file in VS Code and make some changes, then run the update cmdlet.

Making changes in Visual Studio Code
Making changes in Visual Studio Code

Update-CsTeamTemplate -OdataId "/api/teamtemplates/v1.0/a4e03348-39cd-42c7-9035-8c4439b55a21/Tenant/en-US" -Body (Get-Content '.\input.json' | Out-String)

Now, if we create a team based on the template, we get the team settings we want:

Team with updated settings
Team with updated settings

Creating a new template

The easiest way to create a custom template is to copy an existing one and change the settings, just as we did in the update scenario.

(Get-CsTeamTemplate -OdataId "/api/teamtemplates/v1.0/a4e03348-39cd-42c7-9035-8c4439b55a21/Tenant/en-US") > input.json
New-CsTeamTemplate -OdataId "/api/teamtemplates/v1.0/a4e03348-39cd-42c7-9035-8c4439b55a21/Tenant/en-US" -Body (Get-Content '.\input.json' | Out-String)

IMPORTANT! Microsoft uses the Category property to categorize the pre-made templates. If you clone from a base template, you need to set the Category to $null

There are a few other ways you can read about in the documentation for the cmdlet.

Summary

This was a concise post on the benefits of using PowerShell for managing Teams templates. Unfortunately, you cannot create Template Policies via PowerShell; you are stuck with the UI.

Thanks for reading
/Simon


Tags

msteamsgovernancepowershell
Previous Article
Microsoft Teams Templates

Simon Ågren

CTA & Microsoft MVP

Solving business problems with tech

Expertise

Microsoft 365
Azure

Social Media

githubtwitterwebsite

Related Posts

Unveiling the Truth - Custom Sensitivity Label Colors
Unveiling the Truth - Custom Sensitivity Label Colors
March 01, 2024
2 min

Quick Links

About

Social Media