How to create team using custom template

%3CLINGO-SUB%20id%3D%22lingo-sub-2697528%22%20slang%3D%22en-US%22%3EHow%20to%20create%20team%20using%20custom%20template%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2697528%22%20slang%3D%22en-US%22%3E%3CP%3EI%20went%20into%20teams%20admin%20and%20created%20a%20custom%20template%20from%20an%20existing%20team.%26nbsp%3B%20All%20that%20looks%20fine.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20now%20automate%20the%20creation%20of%20teams%20using%20that%20template.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20played%20with%20graph%20and%20PowerShell%20but%20can't%20figure%20out%20how%20to%20do%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20PowerShell%20I'm%20doing%3A%26nbsp%3B%3C%2FP%3E%3CP%3EPS%20C%3A%5CWINDOWS%5Csystem32%26gt%3B%20New-Team%20-DisplayName%20%22TestingTemplates%22%20-Description%20%22Team%20to%20test%20templates%22%20-Visibility%20Private%20-Template%20%22MyTemplate%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EResult%20is%3A%3CBR%20%2F%3ENew-Team%20%3A%20Cannot%20validate%20argument%20on%20parameter%20'Template'.%20The%20argument%20%22MyTemplate%22%20does%20not%20belong%20to%20the%20set%20%22EDU_Class%2CEDU_PLC%22%20specified%20by%20the%20ValidateSet%20attribute.%20Supply%20an%20argument%20that%20is%20in%20the%20set%20and%20then%20try%20the%20command%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPreferably%20I'd%20like%20to%20use%20Microsoft%20Power%20Automate%20to%20do%20this.%26nbsp%3B%20So%20maybe%20a%20rest%20command%3F%26nbsp%3B%20But%20seems%20like%20the%20template%20command%20only%20works%20for%20edu%3F%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20verified%20my%20template%20shows%20up%20using%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGet-CsTeamTemplateList%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3ETerry%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2697528%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECustom%20Template%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2698866%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20create%20team%20using%20custom%20template%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2698866%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F259402%22%20target%3D%22_blank%22%3E%40Mattw112%3C%2FA%3E%26nbsp%3B%3A%20Hey%2C%20I%20looked%20into%20the%20docs%20and%20tried%20few%20stuff%2C.%3CBR%20%2F%3E%3CBR%20%2F%3EUsing%20PowerShell%20you%20can%20only%20use%20this%20two%20values%20EDU_Class%2C%20EDU_PLC.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBut%20with%20Graph%20you%20can%20can%20create%20using%20custom%20template%2C%20it%20takes%20few%20minutes%20to%20reflect%20all%20changes%20but%20it%20work.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3ESo%2C%20when%20you%20create%20template%20on%20Teams%20admin%20center%2C%20you%20get%20an%20Id%20of%20that%20template.%20(see%20screenshot)%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22HunaidHanfeeMSFT_0-1630333470624.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F306692i72B337ADFE92E29A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22HunaidHanfeeMSFT_0-1630333470624.png%22%20alt%3D%22HunaidHanfeeMSFT_0-1630333470624.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUse%20this%20Id%20in%20request%20body%20-%26gt%3B%20%3CA%20href%3D%22mailto%3Atemplate%40odata.bind%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Etemplate%40odata.bind%3C%2FA%3E%20like%20this%3A%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CEM%3E%22template%40odata.bind%22%3A%20%22%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FteamsTemplates('yourTemplateId%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FteamsTemplates('yourTemplateId%3C%2FA%3E')%22%3C%2FEM%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%22template%40odata.bind%22%3A%20%22https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2FteamsTemplates('81e86602-a5b9-0000-a6c2-d3f28c576ee3')%22%2C%0A%22displayName%22%3A%20%22Beta%20Team%22%2C%0A%22description%22%3A%20%22My%20Class%20Description%22%2C%0A%22members%22%3A%20%5B%0A%7B%0A%22%40odata.type%22%3A%20%22%23microsoft.graph.aadUserConversationMember%22%2C%0A%22roles%22%3A%20%5B%0A%22owner%22%0A%5D%2C%0A%22user%40odata.bind%22%3A%20%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fusers('ef16aa89-0000-0000-aebb-761b551577c0')%22%0A%7D%0A%5D%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%20us%20know%20if%20you%20have%20any%20query%20on%20this.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EThanks%2C%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EHunaid%20Hanfee%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E-----------------------------------------------------------------------------------------------------------------%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EIf%20the%20response%20is%20helpful%2C%20please%20click%20%22%3CSTRONG%3EMark%20as%20Best%20Response%3C%2FSTRONG%3E%22%20and%20like%20it.%20You%20can%20share%20your%20feedback%20via%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FDevSupportFeedback)%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EMicrosoft%20Teams%20Developer%20Feedback%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Blink.%20Click%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Faka.ms%2FDevCommunityEscalationForm%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehere%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bto%20escalate.%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

I went into teams admin and created a custom template from an existing team.  All that looks fine.

 

I would like to now automate the creation of teams using that template.

 

I have played with graph and PowerShell but can't figure out how to do this?

 

In PowerShell I'm doing: 

PS C:\WINDOWS\system32> New-Team -DisplayName "TestingTemplates" -Description "Team to test templates" -Visibility Private -Template "MyTemplate"

 

Result is:
New-Team : Cannot validate argument on parameter 'Template'. The argument "MyTemplate" does not belong to the set "EDU_Class,EDU_PLC" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.

 

Preferably I'd like to use Microsoft Power Automate to do this.  So maybe a rest command?  But seems like the template command only works for edu??

 

I have verified my template shows up using:

 

Get-CsTeamTemplateList

 

Thanks,

Terry

 

1 Reply

@Mattw112 : Hey, I looked into the docs and tried few stuff,.

Using PowerShell you can only use this two values EDU_Class, EDU_PLC. 

 

But with Graph you can can create using custom template, it takes few minutes to reflect all changes but it work.

 

So, when you create template on Teams admin center, you get an Id of that template. (see screenshot) 

HunaidHanfeeMSFT_0-1630333470624.png

 

Use this Id in request body -> template@odata.bind like this:

 
{
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('81e86602-a5b9-0000-a6c2-d3f28c576ee3')",
"displayName": "Beta Team",
"description": "My Class Description",
"members": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": [
"owner"
],
"user@odata.bind": "https://graph.microsoft.com/beta/users('ef16aa89-0000-0000-aebb-761b551577c0')"
}
]
}

 

Let us know if you have any query on this.

Thanks, 

Hunaid Hanfee 

-----------------------------------------------------------------------------------------------------------------

If the response is helpful, please click "Mark as Best Response" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

We support Ukraine and condemn war. Push Russian government to act against war. Be brave, vocal and show your support to Ukraine. Follow the latest news HERE