指派策略套件給使用者和群組Assign policy packages to users and groups

本文將審查在 Microsoft Teams 中將策略套件指派給使用者和群組的不同方式。This article reviews the different ways to assign policy packages to users and groups in Microsoft Teams. 閱讀前,請務必先閱讀 Teams 中的指派政策 - 開始使用Before reading, be sure you've read Assign policies in Teams - getting started.

指派策略套件給使用者Assign a policy package to users

Teams 中的策略套件是預先定義的策略和設定集合,您可以指派給組織中相同或類似角色的使用者。A policy package in Teams is a collection of predefined policies and policy settings that you can assign to users who have the same or similar roles in your organization. 每個策略套件都是針對使用者角色設計,並包含預先定義的策略和策略設定,可支援該角色的一般活動。Each policy package is designed around a user role and includes predefined policies and policy settings that support activities typical for that role. 一些政策套件範例包括教育 (教師) 方案,以及醫療保健 (診所) 套件。Some examples of policy packages are the Education (Teacher) package and Healthcare (Clinical worker) package. 若要深入瞭解,請參閱 在 Teams 中管理原則套件To learn more, see Manage policy packages in Teams.

將策略套件指派給一個使用者Assign a policy package to one user

  1. 在 Microsoft Teams 系統管理中心的左側流覽中,前往 使用者,然後 選取使用者。In the left navigation of the Microsoft Teams admin center, go to Users, and then select the user.
  2. 在使用者的頁面上,選取策略,然後在策略套件 旁邊,選取****編輯On the user's page, select Policies, and then next to Policy package, select Edit.
  3. 在指派 策略套件窗格中 ,選取您想要指派的套件, 然後選取 儲存 。In the Assign policy package pane, select the package you want to assign, and then select Save.

系統管理中心螢幕擷取畫面,以將策略套件指派給使用者

指派策略套件給多個使用者Assign a policy package to multiple users

  1. 在 Microsoft Teams 系統管理中心的左側流覽中,前往策略套件,然後按一下套件名稱左側,選取您想要指派的政策套件。In the left navigation of the Microsoft Teams admin center, go to Policy packages, and then select the policy package you want to assign by clicking to the left of the package name.
  2. 選取 [管理使用者]。Select Manage users.
  3. [管理使用者] 窗格中,依顯示名稱或使用者名稱搜尋使用者,選取名稱,然後選取 [新增]In the Manage users pane, search for the user by display name or by user name, select the name, and then select Add. 針對要新增的每一個使用者重複此步驟。Repeat this step for each user that you want to add.
  4. 新增使用者完成後,請選取 儲存When you're finished adding users, select Save.

將策略套件指派給多個使用者的 Teams 系統管理中心螢幕擷取畫面

將原則套件指派給群組Assign a policy package to a group

透過向群組指派原則套件,可以將多個原則指派給一組使用者,例如安全性群組或通訊群組。Policy package assignment to groups let you assign multiple policies to a group of users, such as a security group or distribution list. 原則指派將根據優先順序規則傳播到群組成員。The policy assignment is propagated to members of the group according to precedence rules. 在群組中新增或移除成員時,系統會相應地更新其繼承的原則指派。As members are added to or removed from a group, their inherited policy assignments are updated accordingly.

建議最多 50,000 個使用者群組將策略套件指派給群組,但也會與較大的群組一起使用。Policy package assignment to groups is recommended for groups of up to 50,000 users, but it will also work with larger groups.

當您指派策略套件時,系統會立即將其指派給群組。When you assign the policy package, it's immediately assigned to the group. 不過,將策略指派傳播給群組成員是做為背景作業,可能需要一些時間,視群組大小而不同。However, the propagation of the policy assignment to members of the group is performed as a background operation and might take some time, depending on the size of the group. 當未從群組中未指定策略,或成員新加入群組或從群組中移除時,也是如此。The same is true when a policy is unassigned from a group, or when members are added to or removed from a group.

重要

在您開始使用之前,您必須瞭解 (優先順序規則) (群組作業) 。 Before you get started, it's important to understand (precedence rules) and (group assignment ranking). 請確認您閱讀並瞭解本文 (本文中關於指派給群組之) 中必須瞭解的概念。Make sure you read and understand the concepts in (What you need to know about policy assignment to groups) earlier in this article.

將策略套件指派給系統管理中心的一組使用者Assign a policy package to a group of users in the admin center

  1. 登入 Teams 系統管理中心。Sign in to the Teams admin center.

  2. 在左側流覽中,前往策略套件頁面。In the left navigation, go to the policy package page.

  3. 選取群組原則工作分派選項卡。Select the Group policy assignment tab.

  4. 選取 新增群組,然後在指派策略套件至群組窗格中,執行下列操作:Select Add group, and then in the Assign a policy package to group pane, do the following:

    a.a. 搜尋並新增要指派策略套件的群組。Search for and add the group you want to assign the policy package to.

    b.b. 選取一個策略套件。Select a policy package.

    C。c. 設定每個策略類型的排名。Set the ranking for each policy type.

    D。d. 選取 ApplySelect Apply.

顯示群組原則指派

  1. 若要管理特定策略類型的排名,請流覽至特定策略頁面。To manage ranking for a specific policy type, navigate to the specific policy page.
  2. 若要將策略套件重新指派給群組,請先移除群組原則指派。To reassign a policy package to a group, first remove the group policy assignment. 接著,請遵循上述步驟,將策略套件指派給群組。Then, follow the steps above to assign the policy package to a group.

使用 PowerShellWork with PowerShell

取得 Teams PowerShell 模組Get the Teams PowerShell module

有關逐步指南,請參閱安裝 Teams PowerShellFor step-by-step guidance, see Install Teams PowerShell.

將策略套件指派給一組使用者Assign a policy package to a group of users

使用 Grant-CsGroupPolicyPackageAssignment Cmdlet 將策略套件指派給群組。Use the Grant-CsGroupPolicyPackageAssignment cmdlet to assign a policy package to a group. 您可以使用物件識別碼、SIP 位址或電子郵件地址來指定群組。You can specify a group by using the object ID, SIP address, or email address. 當您指派策略套件時,請針對 (中) 類型指定群組分派排名。When you assign the policy package, specify a (group assignment ranking) for each policy type in the policy package.

在此範例中,我們將 Education_Teacher 策略套件指派給一個群組,其 TeamsAppSetupPolicy 和 TeamsMeetingBroadcastPolicy 的作業排名為 1,而 TeamsMeetingPolicy 的排名為 2。In this example, we assign the Education_Teacher policy package to a group with an assignment ranking of 1 for TeamsAppSetupPolicy and TeamsMeetingBroadcastPolicy and a ranking of 2 for TeamsMeetingPolicy.

Grant-CsGroupPolicyPackageAssignment -GroupId "dae90bb4-120f-4a3e-a15d-30f142e79f69" -PackageName "Education_Teacher" -PolicyRankings "TeamsAppSetupPolicy, 1", "TeamsMeetingBroadcastPolicy, 1", "TeamsMeetingPolicy, 2"

將策略套件指派給一批使用者Assign a policy package to a batch of users

使用批次策略套件指派,您可以一次指派一群組原則套件給大型使用者,而不需要使用腳本。With batch policy package assignment, you can assign a policy package to large sets of users at a time without having to use a script. 您可以使用 New-CsBatchPolicyAssignmentOperation Cmdlet 提交一批使用者和您想要指派的政策套件。You use the New-CsBatchPolicyAssignmentOperation cmdlet to submit a batch of users and the policy package that you want to assign. 系統會將工作處理為背景作業,並為每個批次產生作業識別碼。The assignments are processed as a background operation and an operation ID is generated for each batch. 接著,您可以使用 Get-CsBatchPolicyAssignmentOperation Cmdlet 來追蹤批次中作業的進度和狀態。You can then use the Get-CsBatchPolicyAssignmentOperation cmdlet to track the progress and status of the assignments in a batch.

根據使用者的物件識別碼或會話初始通訊協定 (SIP) 位址。Specify users by their object ID or Session Initiation Protocol (SIP) address. 使用者的 SIP 位址通常與 UPN 或電子郵件地址的使用者主體名稱 (相同) ,但這不是必要的。A user's SIP address often has the same value as the User Principal Name (UPN) or email address, but this isn't required. 如果使用者是使用 UPN 或電子郵件指定,但其值與 SIP 位址不同,則使用者的策略指派將會失敗。If a user is specified using their UPN or email, but it has a different value than their SIP address, then policy assignment will fail for the user. 如果批次包含重複的使用者,則重複專案將在處理前從批次中移除,而狀態只會提供給批次中的唯一使用者。If a batch includes duplicate users, the duplicates will be removed from the batch before processing and status will only be provided for the unique users remaining in the batch.

批次最多包含 5,000 個使用者。A batch contains up to 5,000 users. 為了獲得最佳結果,一次不要提交多個批次。For best results, don't submit more than a few batches at a time. 在提交更多批次之前,允許批次完成處理。Allow batches to complete processing before submitting more batches.

使用 Teams PowerShell 模組Use the Teams PowerShell module

如果您尚未安裝 Microsoft Teams PowerShell 模組 (請執行下列) 。Run the following to install the Microsoft Teams PowerShell module (if you haven't already). 請確定您安裝版本 1.0.5 或更新版本。Make sure you install version 1.0.5 or later.

Install-Module -Name MicrosoftTeams

執行下列操作以連接到 Teams 並開始會話。Run the following to connect to Teams and start a session.

Connect-MicrosoftTeams

系統提示您時,請使用系統管理員認證來登錄。When you're prompted, sign in using your admin credentials.

指派策略套件給一批使用者Assign policy packages to a batch of users

在此範例中,我們使用 New-CsBatchPolicyAssignmentOperation Cmdlet 將 Education_PrimaryStudent原則套件指派給一批使用者。In this example, we use the New-CsBatchPolicyAssignmentOperation cmdlet to assign the Education_PrimaryStudent policy package to a batch of users.

New-CsBatchPolicyPackageAssignmentOperation -Identity 1bc0b35f-095a-4a37-a24c-c4b6049816ab,user1@econtoso.com,user2@contoso.com -PackageName Education_PrimaryStudent

查看批次作業的狀態See the status of a batch assignment

執行下列操作以取得批次工作分派的狀態,其中 OperationId 是 Cmdlet 針對指定批次所返回 New-CsBatchPolicyAssignmentOperation 的操作識別碼。Run the following to get the status of a batch assignment, where OperationId is the operation ID that's returned by the New-CsBatchPolicyAssignmentOperation cmdlet for a given batch.

$Get-CsBatchPolicyAssignmentOperation -OperationId f985e013-0826-40bb-8c94-e5f367076044 | fl

如果輸出顯示發生錯誤,請執行下列操作,以取得有關錯誤的詳細資訊 ,而錯誤則出現在 UserState 屬性中。If the output shows that an error occurred, run the following to get more information about errors, which are in the UserState property.

Get-CsBatchPolicyAssignmentOperation -OperationId f985e013-0826-40bb-8c94-e5f367076044 | Select -ExpandProperty UserState

若要深入瞭解,請參閱 Get-CsBatchPolicyAssignmentOperationTo learn more, see Get-CsBatchPolicyAssignmentOperation.