Microsoft Teams for ITPro: Deal with Policy packages and assign package using batch assignment

Now inside PowerShell module for Teams new capability appears, which allows IT admins to assign policies to users using package batch assignments. Option is already in GA, so ready and safe for production. A policy package in Microsoft Teams is a collection of predefined policies and policy settings that you can assign to users who have similar roles in your organization. 


If you don't have module for Teams installed, please first follow this knowledge base article: https://docs.microsoft.com/en-us/MicrosoftTeams/teams-powershell-install

Let's start with PowerShell module update for Teams:
Update-Module MicrosoftTeams

If Teams module was imported already, updating module will fail, so best idea is to re-open a new elevated prompt.

Now module should support new options:
- Policy assignment to Office 365 Groups
- Batch assignment of policies or policy packages (up to 5k* users)

* - For best results, do not submit more than a few batches at a time. Allow batches to complete processing before submitting more batches.

First let's check what is inside policy package dedicated for "Firstline_Worker"

Get-CsPolicyPackage -Identity "FirstLine_Worker"


Name        : FirstLine_Worker
Description : This is a FirstLine_Worker package
Policies    : {TeamsMessaging, TeamsMeeting, TeamsAppSetup, TeamsCalling...}


PolicyName    : TeamsMessaging
PolicyContent : {
                  "Identity": "FirstLine_Worker",
                  "Description": "This is a FirstLine_Worker Messaging policy",
                  "AllowOwnerDeleteMessage": true,
                  "AllowUserEditMessage": true,
                  "AllowUserDeleteMessage": true,
                  "AllowUserChat": true,
                  "AllowGiphy": true,
                  "GiphyRatingType": "Moderate",
                  "AllowMemes": true,
                  "AllowStickers": true,
                  "ReadReceiptsEnabledType": "Everyone",
                  "AllowUrlPreviews": true,
                  "AllowUserTranslation": true,
                  "AllowImmersiveReader": true,
                  "AllowPriorityMessages": false,
                  "AudioMessageEnabledType": "ChatsAndChannels",
                  "ChannelsInChatListEnabledType": "EnabledUserOverride",
                  "AllowRemoveUser": true
                }


PolicyName    : TeamsMeeting
PolicyContent : {
                  "Identity": "FirstLine_Worker",
                  "Description": "This is a FirstLine_Worker TeamsMeeting policy"
                }


PolicyName    : TeamsAppSetup
PolicyContent : {
                  "Identity": "FirstLine_Worker",
                  "Description": "This policy is part of the FirstLine_Worker policy package. This policy can be
                customized.",
                  "PinnedAppBarApps": [
                    {
                      "Id": "14d6962d-6eeb-4f48-8890-de55454bb136",
                      "Order": "1"
                    },
                    {
                      "Id": "86fcd49b-61a2-4701-b771-54728cd291fb",
                      "Order": "2"
                    },
                    {
                      "Id": "2a84919f-59d8-4441-a975-2a8c2643b741",
                      "Order": "3"
                    },
                    {
                      "Id": "42f6c1da-a241-483a-a3cc-4f5be9185951",
                      "Order": "4"
                    },
                    {
                      "Id": "db5e5970-212f-477f-a3fc-2227dc7782bf",
                      "Order": "5"
                    }
                  ],
                  "PinnedAppBarAppsForInput": {
                    "replace": [
                      {
                        "Id": "14d6962d-6eeb-4f48-8890-de55454bb136",
                        "Order": "1"
                      },
                      {
                        "Id": "86fcd49b-61a2-4701-b771-54728cd291fb",
                        "Order": "2"
                      },
                      {
                        "Id": "2a84919f-59d8-4441-a975-2a8c2643b741",
                        "Order": "3"
                      },
                      {
                        "Id": "42f6c1da-a241-483a-a3cc-4f5be9185951",
                        "Order": "4"
                      },
                      {
                        "Id": "db5e5970-212f-477f-a3fc-2227dc7782bf",
                        "Order": "5"
                      }
                    ]
                  }
                }


PolicyName    : TeamsCalling
PolicyContent : {
                  "Identity": "FirstLine_Worker",
                  "Description": "This is a FirstLine_Worker Calling policy",
                  "AllowPrivateCalling": true,
                  "AllowCallForwardingToUser": false,
                  "AllowCallForwardingToPhone": false,
                  "AllowVoicemail": "AlwaysDisabled",
                  "PreventTollBypass": false,
                  "BusyOnBusyEnabledType": "Disabled"
                }


PolicyName    : TeamsMeetingBroadcast
PolicyContent : {
                  "Identity": "FirstLine_Worker",
                  "Description": "This is a FirstLine_Worker TeamsBroadcast policy",
                  "AllowBroadcastScheduling": false,
                  "AllowBroadcastTranscription": true
                }


Now let's assign batch policy package to specific users:
New-CsBatchPolicyPackageAssignmentOperation -Identity 1bc0b35f-095a-4a37-a24c-c4b6049816ab,user1@econtoso.com,user2@contoso.com -PackageName FirstLine_Worker

$Get-CsBatchPolicyAssignmentOperation -OperationId "id_number" | fl

Summary:

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. The assignments are processed as a background operation and an operation ID is generated for each batch. You can then use the Get-CsBatchPolicyAssignmentOperation cmdlet to track the progress and status of the assignments in a batch.

You can specify users by their object Id or Session Initiation Protocol (SIP) address. Note that a user's SIP address often has the same value as the User Principal Name (UPN) or email address, but this is not required. 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.

Information about policy packages Firstline_Worker you could find also in July 2020 news:


Comments