Microsoft がすべての製品とサービスのセキュリティ体制を強化するにつれて、API 機能に 変更 が加わり、API を使用して Class Notebook と Class Teams をプロビジョニングするためにアプリのみのアクセス許可に以前依存していたお客様に影響を与える可能性があります。
注: ほとんどの場合、学生情報または管理システムのユーザーと名簿データを Microsoft 365 と同期するプロセスを自動化するのに役立つ無料サービスである School Data Sync(SDS) を使用することをお勧めします。 SDS を使用すると、教育organization、ユーザー、クラス、ロールを管理し、データをMicrosoft Entra IDと Microsoft 365 と同期できるため、Microsoft Teams、教育、Exchange Online、SharePoint Online、OneNote Class ノートブックのIntuneを使用し、サード パーティ製アプリを有効にすることができます。シングル サインオン統合。
サポートされているメソッドに従って、PowerShell と Microsoft Graph を使用して、クラスとノートブックを大規模にプロビジョニングできます。 この記事では、手順の概要を説明し、関連するドキュメントへのリンクを示します。
重要: クラスの大規模なプロビジョニングでサード パーティ パートナーと連携している場合は、独自の手順を実行する前に、この記事を共有してください。
新しいクラスのプロビジョニング
オプション 1 (推奨): Teams PowerShell を使用する
警告: 2025 年 8 月 21 日より前に、このドキュメントの以前のバージョンでは、必要な更新が行われる前に Teams PowerShell を使用したプロビジョニングが推奨されていました。 これらの更新プログラムは完了し、 現時点ではこの方法を続行できます。 お待ちいただき、ありがとうございました。
Teams PowerShell を使用して新しいクラスをプロビジョニングするのは簡単です。これには、クラスとノートブックに必要なすべてのセットアップが含まれます。 次のスクリプトで目的の表示名をカスタマイズし、管理者として実行するだけです。
サンプル スクリプト
# Using the Teams PowerShell SDK
Install-Module -MicrosoftTeams -Force -AllowClobber
New-Team -DisplayName 'Test Class 20251208.4' -Template 'EDU_Class'
|
オプション 2: Microsoft Graph PowerShell の使用
Teams PowerShell にアクセスできない場合は、Microsoft Graph を使用して、プロビジョニング クラスを大規模に調べることができます。 次のスクリプトの上部にあるパラメーターを必要に応じて編集し、管理者としてスクリプトを実行して、クラスとノートブックを大規模にプロビジョニングします。
サンプル スクリプト
# Using the MS Graph API
Install-Module Microsoft.Graph -AllowClobber -Force
# PARAMETERS
$Name = "Test Class 20251208.3"
$Description = "A Test Class"
$Mail = $Name -replace '[^a-zA-Z0-9\s]|[ ]', '' # Replace this mail alias with a preferred generation method
$OwnerId = "000-000-00000-000000-000" # Replace this with the Owner's GUID
# ------------
# Create a new M365 Group
$CreateGroupBody = @"
{
"description": "$Name",
"displayName": "$Description",
"groupTypes": [
"Unified"
],
"mailEnabled": false,
"mailNickname": "$Mail",
"securityEnabled": false,
"members@odata.bind": [
"https://graph.microsoft.com/v1.0/users/$OwnerId"
],
"owners@odata.bind": [
"https://graph.microsoft.com/v1.0/users/$OwnerId"
],
"visibility": "HiddenMembership",
"creationOptions": [
"ExchangeProvisioningFlags:461",
"classAssignments"
],
"extension_fe2174665583431c953114ff7268b7b3_Education_ObjectType": "Section",
"resourceBehaviorOptions": [
"appRoleForSite:22d27567-b3f0-4dc2-9ec2-46ed368ba538:fullcontrol",
"appRoleForSite:c9a559d2-7aab-4f13-a6ed-e7e9c52aec87:fullcontrol",
"appRoleForSite:13291f5a-59ac-4c59-b0fa-d1632e8f3292:fullcontrol",
"appRoleForSite:2d4d3d8e-2be3-4bef-9f87-7875a61c29de:fullcontrol",
"appRoleForSite:8f348934-64be-4bb2-bc16-c54c96789f43:fullcontrol"
]
}
"@
$NewGroup = Invoke-MgGraphRequest -uri 'https://graph.microsoft.com/v1.0/groups/' -Body $CreateGroupBody -Method POST -ContentType "application/json"
# Create Teams Class Team from group
$CreateTeamBody = @{
"template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')"
"group@odata.bind" = "https://graph.microsoft.com/v1.0/groups('$($NewGroup.Id)')"
}
New-MgTeam -BodyParameter $CreateTeamBody
|
トラブルシューティング: 既存のクラス サイトにアクセス許可を付与する
注: この方法では、ここで説明するように、スクリプトを実行しているユーザーがサイト管理者である必要 もあります。 次のスクリプトには、トラブルシューティングを必要とするサイトのサイト管理者として、現在ログインしているユーザーを追加する手順が含まれています。
クラスを既にプロビジョニングしていて、Class Notebook または Teams の割り当てでエラーやアクセス許可の問題が発生している場合は、次のスクリプトを使用してクラスのサイトアクセス許可を更新し、rawGroups パラメーターを影響を受けるクラスの group ID に置き換えることができます。
サンプル スクリプト
#You will need to connect to SharePoint, Exchange Online, and Graph with the following -Scopes Sites.FullControl.All, as well as collect the groupIDs of Class Teams affected
$rawGroups =@("b0a5905d-09ae-4605-8e12-94da93ecbe92","e0eec729-24ef-451e-b079-56d0baf4dfc9")
# Convert to array of objects with .groupid
$groups = $rawGroups | ForEach-Object { Get-UnifiedGroup -Identity $_ }
$step = 0
#get the currently logged in user's account to add as a site admin
$CUA = (get-mgcontext).account
foreach ($group in $groups) {
$step = $step + 1
Set-SPOUser -Site $group.SharePointSiteUrl -LoginName $CUA -IsSiteCollectionAdmin $true
Write-Host "SiteCollectionAdmin added on $step of $($Groups.Count) Class Sites"
}
#Pause for 5 minutes before tiggering the General Folder creation
Write-Host "Pausing for 5 Minutes before adding perms to allow SiteCollectionAdmin to propagate"
Start-Sleep -Seconds 300
Write-Host "Working on $($Groups.Count) Classes"
foreach ($group in $groups) {
#$step = $step + 1
$Site = Get-MgGroupSite -GroupId $group.ExternalDirectoryObjectId -SiteId "root"
$SiteId = $Site.Id
Write-Host "Processing permissions on $step of $($Groups.Count) Classes"
# These are the AppIds for common Microsoft EDU Apps
$AppIds = @{
"8f348934-64be-4bb2-bc16-c54c96789f43"="EDU Assignments";
"22d27567-b3f0-4dc2-9ec2-46ed368ba538"="Reading Assignments";
"2d4d3d8e-2be3-4bef-9f87-7875a61c29de"="OneNote";
"c9a559d2-7aab-4f13-a6ed-e7e9c52aec87"="Microsoft Forms";
"13291f5a-59ac-4c59-b0fa-d1632e8f3292"="EDU OneNote";
}
# Apply the permissions to the group site
$AppIds.Keys | %{
$AppId = $_
$Name = $AppIds[$_]
$Body = @"
{
"roles": ["fullcontrol"],
"grantedToIdentities": [{
"application": {
"id": "$AppId",
"displayName": "$Name"
}
}]
}
"@
Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/v1.0/sites/$SiteId/permissions" -Body $Body -ContentType "application/json"
}
}
Write-Host "Processed $($Groups.Count) Classes, removing sitecollectionadmin"
$step = 0
foreach ($group in $groups) {
$step = $step + 1
Set-SPOUser -Site $group.SharePointSiteUrl -LoginName $CUA -IsSiteCollectionAdmin $false
Write-Host "SiteCollectionAdmin removed on $step of $($Groups.Count) Class Sites"
}
|