Get All MS Teams Class/Groups by AppId
Review the queries recorded for finding Teams classes created by the CCM Teams Management service principal, including school/year filtering.
Source-derived reference
These notes were recovered from OneNote. Configuration, permissions and operating results have not been freshly verified. Confirm the applicable authority and environment before acting.
GET ALL TEAMS CREATED BY TEAMS MANAGEMENT
The Teams Management Script uses Entra App Service Principal Id to make changes in M365.
You can see all Teams created by the Service Principal Id by searching for it.
All the MS Teams are created by this Entra App. Entra App CCM-Teams-Manager - Microsoft Entra admin center Service Principal ID: c9c52a29-da16-49bb-aaf1-2808c91d8a87
EXAMPLE: GET ALL TEAMS GROUPS CREATED BY Entra App Service Principal Id Connect-MgGraph $AutomatedTeamsClassGroups = Get-MgBetaGroup -All -Filter "extension_fe2174665583431c953114ff7268b7b3_Education_CreatedByUserId eq 'c9c52a29-da16-49bb-aaf1-2808c91d8a87'" -ConsistencyLevel "eventual" -CountVariable $count
OR
#You could use this options but it is a bit slower
$AutomatedTeamsClassGroups = Get-MgBetaGroup -All -ConsistencyLevel "eventual" -CountVariable $count | where {(_.AdditionalProperties).extension_fe2174665583431c953114ff7268b7b3_Education_CreatedByUserId -eq "c9c52a29-da16-49bb-aaf1-2808c91d8a87"}
GET ALL TEAMS CREATED FOR A SCHOOL IN A GIVEN YEAR
FORMAT the MailNickname is in the below for your school: YEAR-FIRSTNAMEOFSCHOOL
- Livingstone: 2026-LIVINGSTONE
- Chinchilla: 2026-CHINCHILLA
- Whitsunday: 2026-WHITSUNDAY
- etc…
EXAMPLE 1: GROUPS CREATED FOR LIVINGSTONE CC IN 2026 #To search for Livingstone groups you would filter using 2026-LIVINGSTONE Connect-MgGraph
$LivingstoneGroups = Get-MgBetaGroup -All -Filter "startsWith(MailNickname, '2026-LIVINGSTONE')" -ConsistencyLevel "eventual" -CountVariable $count | where {(_.AdditionalProperties).extension_fe2174665583431c953114ff7268b7b3_Education_CreatedByUserId -eq "c9c52a29-da16-49bb-aaf1-2808c91d8a87"}
EXAMPLE 2: GROUPS CREATED FOR HOPE CC IN 2025 by MailNickname
#To search for Hope groups you would filter using 2026-CHINCHILLA Connect-MgGraph
$HopeGroups = Get-MgBetaGroup -All -Filter "startsWith(MailNickname, '2026-CHINCHILLA')" -ConsistencyLevel "eventual" -CountVariable $count | where {(_.AdditionalProperties).extension_fe2174665583431c953114ff7268b7b3_Education_CreatedByUserId -eq "c9c52a29-da16-49bb-aaf1-2808c91d8a87"}