Microsoft Teams PowerShell module version 2.0.0 was just released for general availability. Module includes also cmdlets for managing team templates with support for basic CRUD operations. With the new module requirement for connecting Skype for Business Online is also deprecated, only Connect-MicrosoftTeams
is required for using all included cmdlets.

Listing templates
All templates available can be listed with Get-CsTeamTemplateList
, which returns OdataId, Name, Short Description, and count of Apps and Channels.

OdataId property includes template’s id, scope (custom or Microsoft provided) and localization.

Template scope Public identifies Microsoft provided template and Tenant a custom template. Public scoped templates cannot be removed or updated with PowerShell.
What is included in a template
When getting a single template with Get-CsTeamTemplate -OdataId /api/teamtemplates/v1.0/com.microsoft.teams.template.ManageAProject/Public/en-US
, it returns JSON representation of the template. Schema includes familiar objects from the schema of a team template documented on Microsoft Graph API documentation. There are properties at the end for template icon, short description, category and published by.
{
"templateId": "com.microsoft.teams.template.ManageAProject",
"displayName": "Manage a Project",
"description": "Manage tasks, share documents, conduct project meetings and document risks and decisions with this template for general project management.",
"specialization": "None",
"visibility": "Private",
"channels": [
{
"id": "General",
"displayName": "General",
"description": "",
"isFavoriteByDefault": true,
"tabs": [ ]
},
{
"id": "com.microsoft.teams.template.ManageAProject.channel1",
"displayName": "Announcements 📢",
"description": "Use this channel to make important team and event announcements.",
"isFavoriteByDefault": true,
"tabs": [ ]
},
{
"id": "com.microsoft.teams.template.ManageAProject.channel2",
"displayName": "Resources",
"description": "",
"isFavoriteByDefault": false,
"tabs": [ ]
},
{
"id": "com.microsoft.teams.template.ManageAProject.channel3",
"displayName": "Planning",
"description": "",
"isFavoriteByDefault": false,
"tabs": [
{
"id": "com.microsoft.teams.template.ManageAProject.channel3.tab0",
"teamsAppId": "0d820ecd-def2-4297-adad-78056cde7c78",
"name": "Planning Notes"
},
{
"id": "com.microsoft.teams.template.ManageAProject.channel3.tab1",
"teamsAppId": "com.microsoft.teamspace.tab.planner",
"name": "Project plans"
}
]
}
],
"memberSettings": {
"allowCreateUpdateChannels": true,
"allowDeleteChannels": true,
"allowAddRemoveApps": true,
"uploadCustomApp": false,
"allowCreateUpdateRemoveTabs": true,
"allowCreateUpdateRemoveConnectors": true,
"allowCreatePrivateChannels": true
},
"guestSettings": {
"allowCreateUpdateChannels": false,
"allowDeleteChannels": false
},
"messagingSettings": {
"allowUserEditMessages": true,
"allowUserDeleteMessages": true,
"allowOwnerDeleteMessages": true,
"allowTeamMentions": true,
"allowChannelMentions": true
},
"funSettings": {
"allowGiphy": true,
"giphyContentRating": "Moderate",
"allowStickersAndMemes": true,
"allowCustomMemes": true
},
"discoverySettings": {
"showInTeamsSearchAndSuggestions": true
},
"apps": [
{
"id": "com.microsoft.teamspace.tab.wiki"
},
{
"id": "0d820ecd-def2-4297-adad-78056cde7c78"
},
{
"id": "com.microsoft.teamspace.tab.planner"
},
{
"id": "26bc2873-6023-480c-a11b-76b66605ce8c"
},
{
"id": "7c316234-ded0-4f95-8a83-8453d0876592"
}
],
"icon": "https://statics.teams.cdn.office.net/evergreen-assets/teamtemplates/icons/project_management.svg",
"shortDescription": "Coordinate your project.",
"categories": [ "General" ],
"publishedBy": "Microsoft"
}
Creating a new template
Empty template with default settings, and without channels or apps, can be created with New-CsTeamTemplate -DisplayName "Template name" -ShortDescription "Template description" -Locale en-US
.
Easiest way to create a custom template is either getting an existing template to a file or to an object, and modify it. You can also use a complex object, which is documented here: https://docs.microsoft.com/en-us/powershell/module/teams/new-csteamtemplate?view=teams-ps#notes
Getting an existing template to a file
(Get-CsTeamTemplate -OdataId '/api/teamtemplates/v1.0/com.microsoft.teams.template.AdoptOffice365/Public/en-US') > input.json
If a Microsoft provided template is used as a source, categories need to be removed from template file or set Category property as null, otherwise creating a new template will return an error.
Creating a new template from template file:
New-CsTeamTemplate -Locale en-Us -Body (Get-Content .\input.json | Out-String)
Getting an existing template to an object, and removing categories
$template = Get-CsTeamTemplate -OdataId /api/teamtemplates/v1.0/com.microsoft.teams.template.ManageAProject/Public/en-US
$template.Category = $null
Creating a new template from object:
New-CsTeamTemplate -Local en-Us Body $template
Update existing custom templates
Update capability to templates is really useful for settings templates settings, which are not currently available on Teams Admin Center. Member, guest, messaging and fun settings, which are all set to false by default, can be updated. Updating a template is fairly straight-forward. First template is retrieved to an object or to a file, like in the previous section, object or file is modified, and finally template is updated.
Here is an example to update fun settings and published by information.
$template = Get-CsTeamTemplate -OdataId /api/teamtemplates/v1.0/b2d0f47f-aeb0-4bb0-866d-b8c4cee14d3b/Tenant/en-US
$template.FunSetting.AllowCustomMeme = $true
$template.FunSetting.AllowGiphy = $true
$template.FunSetting.AllowStickersAndMeme = $true
$template.PublishedBy = "Matti Paukkonen"
Update-CsTeamTemplate -OdataId /api/teamtemplates/v1.0/b2d0f47f-aeb0-4bb0-866d-b8c4cee14d3b/Tenant/en-US -Body $template

Afterword
Updating template settings is a really needed improvement since it’s not available on Teams Admin Center. PowerShell is also useful, if templates are needed to be cloned to different languages, or some template settings need to be changed to all custom template, for example guest settings.
How about actually using templates to create teams via powershell or graph ? Although i can now list templates, i cannot actually use them to create new Teams via code
LikeLike
It’s not possible with Teams PowerShell, but you can use templates when creating a team with Microsoft Graph.
LikeLike
How can you create a new team with the template using powershell?
LikeLike
Templates can be used when creating a team with Microsoft Graph.
LikeLike
Hi Matti
do you know if the creation of teams group via powershell using templates is planned soon by microsoft?
LikeLike
Straining the limit of the topic a bit, but is it possible to see the template used to create a Team?
LikeLike
It’s not currently available. Template property is documented in the Graph API beta docs, but it’s not returning any value.
LikeLike
Can you use the Remove-CsTeamTemplate script to remove the ‘Class’ template?
LikeLike