0

I can't seem to find anything on this specific error. I first create a group that only has an owner, then add a team to the group, which fails. This was executing successfully the other day, so I'm not sure what's going on.

Failed to execute Templates backend request CreateTeamFromGroupWithTemplateRequest. Request Url: https://teams.microsoft.com/fabric/amer/templates/api/group
s/(group ID)/team, Request Method: PUT, Response Status Code: NotFound, Response Headers: Strict-Transport-Security: max-age=25920
00
x-operationid: 4891d546ce7d4cc1b7628971535f4589
x-telemetryid: 00-4891d546ce7d4cc1b7628971535f4589-f648563539f19266-01
X-MSEdge-Ref: Ref A: C77457E24A6040CF833842B3D48AEA55 Ref B: CH1AA2020613029 Ref C: 2023-04-28T16:38:14Z
Date: Fri, 28 Apr 2023 16:38:14 GMT
, ErrorMessage : {"errors":[{"message":**"Failed to execute GetGroupMembersMezzoCountAsync."**,"errorCode":"Unknown"}],"operationId":"4891d546ce7d4cc1b762897153
5f4589"}

Code to add team to group:

$NewTeamParams = @{
  "template@odata.bind"="https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
  "group@odata.bind"="https://graph.microsoft.com/v1.0/groups('$($Group.Id)')"
}
New-MgTeam -BodyParameter $NewTeamParams -ErrorAction Stop

The group ID is from this script, which executes successfully:

$GroupOwner = (Get-MgUser -UserId $GroupOwnerEmail).Id
$Owner = "https://graph.microsoft.com/v1.0/users/" + $GroupOwner
$NewGroupParams = @{
    "displayName" = $TeamName
    "mailNickname"= $TeamMail
    "description" = $TeamDesc
    "owners@odata.bind" = @($Owner)
    "groupTypes" =  @(
                       "Unified"
                     )
    "mailEnabled" =  "true"
    "securityEnabled" = "true"
    "assignedLabels" = @(
                        @{"LabelId"=$SensitivityLabelId}
                        )
}
$Group = New-MgGroup -BodyParameter $NewGroupParams -ErrorAction Stop

I had this working the other day. I am not sure what else to try.

  • As mentioned in the documentation: If the group was created less than 15 minutes ago, it's possible for the Create team call to fail with a 404 error code due to replication delays. We recommend that you retry the Create team call three times, with a 10 second delay between calls. – Mehtab Siddique May 03 '23 at 09:54
  • Thank you, @MehtabSiddique! I introduced a 15-minute delay before attempting to add the team to the group, and it was successful. Your recommendation is a little confusing though in that it's stated it can take up to 15 minutes for replication, though the three retries would only take up 30 seconds. Also, can you please point me to the documentation? I couldn't find "replication" in the [New-MgTeam documentation](https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.teams/new-mgteam?view=graph-powershell-1.0). – Steve-o-rama309 May 11 '23 at 14:05
  • I paired the wait time down to 30 seconds and it seems to be working fine. I have a loop built in where if it fails, it waits another 30 seconds and tries again. It does this up to 15 minutes max. – Steve-o-rama309 May 12 '23 at 21:31

0 Answers0