As Part of a bigger script I want to create a team based on a custom template, that was created using the Teams Admin Centre.
Code:
$additionalProperties = @{
"[email protected]" = "https://graph.microsoft.com/v1.0/teamsTemplates('61dd73eb-e6f9-4cbc-a4cd-e1b3361bc732')"
}
New-MgTeam -DisplayName $nameInput -AdditionalProperties $additionalProperties
When executed the following error is produced:
New-MgTeam : Failed to execute Templates backend request CreateTeamFromTemplateRequest. Request Url: https://teams.microsoft.com/fabric/emea/templates/api/team, Request Method: POST, Response Status Code: BadRequest, Response
Headers: Strict-Transport-Security: max-age=2592000
x-operationid: 73ec38f46526a24ead771f5bf18b18c7
x-telemetryid: 00-73ec38f46526a24ead771f5bf18b18c7-bcdad6964c63974f-00
X-MSEdge-Ref: Ref A: 925751B7C21147D095C5259123CB69CE Ref B: AMS04EDGE2020 Ref C: 2021-12-06T11:02:29Z
Date: Mon, 06 Dec 2021 11:02:29 GMT
, ErrorMessage : {"errors":[{"message":"A template with id '61dd73eb-e6f9-4cbc-a4cd-e1b3361bc732' and locale 'en-US' could not be found.","errorCode":"Unknown"}],"operationId":"73ec38f46526a24ead771f5bf18b18c7"}
At C:\Scripts\teams_powershell\script.ps1:77 char:7
New-MgTeam -DisplayName $nameInput -AdditionalProperties $addit ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidOperation: ({ body = Micros...oftGraphTeam1 }:<>f__AnonymousType1`1) [New-MgTeam_CreateExpanded1], RestException`1
FullyQualifiedErrorId : BadRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgTeam_CreateExpanded1
According to the error it can't seem to find the template.
Is there something I missed here?
Does the New-MgTeam
command need additional or different information to properly function?
Thanks in advance.
CodePudding user response:
So we found the solution: Turns out that we had to wait 24 Hours before using a custom template thet we created.