Assign policies in Microsoft Teams – the easy way

The challenge

Assigning policies in Teams or SfB Online can be a tough task when you are not using the global policy for all of your users. We had our challenges again last week to assign multiple policies to around 17.000 users. Even if you tranche your users and are using a session timer to re-connect the SfB Online Powershell it takes a long time until you have finished all your users. We even found ourselves in a situation were could not connect any SfBO Powershell or our sessions we massively throttled.

If you are looking for some guidance on how to optimize your batch processing here are some links that helped us:

Mark Vale has a blog post about tranching users for batch processing:

Lee Ford has a nice concept of a session timer in his script:

A Microsoft employee also has some helpful scripts to create robust cloud commands:

Batch Policy Assignment

When we prepared this change, I was hoping we haven’t to go down that route, because I read on Twitter that we will soon get some batch assignment of users in Teams. A college (Thomas Galland) tested this upfront and it was not working yet. Today he noticed it started to work and thanks to him we had an early closing time. So for those who have been waiting for this – It’s finally there and working (at least in our tenant).


The documentation can be found here:

What does it do?

You can now submit bulk assignment jobs directly to Teams without having a script and watch progress bars for hours.

What do you need?

The preview module of Microsoft Teams.

As of today (23.03.2020) it has version 1.0.21 and is still in preview but it worked for us very well.

Here is the guide on how to install it:

Register-PSRepository -SourceLocation -Name PsTestGallery -InstallationPolicy Trusted

Uninstall-Module MicrosoftTeams -AllVersions

Install-Module MicrosoftTeams -Repository PSTestGallery

How can I create a batch job?

$user_ids = Get-Content .\users_ids.txt

New-CsBatchPolicyAssignmentOperation -PolicyType TeamsMeetingPolicy -PolicyName "CC-Default" -User $user_ids -OperationName "Update Meeting Policy – Ludicrous style"

The users must be in a proper format. No headlines, One user per line, No quotation marks.

You can specify users by their object Id, UPN, SIP address or email address. I used the SIP address.

We haven’t tested yet the variant to get users directly via Azure AD PowerShell module.

The only caveat is that only certain policy types are allowed. Don’t panic it’s 18 of them. Check if your required policy is mentioned here:

Microsoft says you can create batches of 20.000 users. For now, they are recommending batches of 5.000 users.

If you created your job you get an ID that you can use to view the status of your job. It can take a minute or two until you see the job. The progress is updated approximately every 30 seconds.

You can also check details about the errors:

Get-CsBatchPolicyAssignmentOperation -OperationId 0054ed9d-00f6-4a19-8c98-c8b46e115bf6 | Select -ExpandProperty UserState

You will be impressed by how fast your job is done. It’s now minutes and not hours.

There is more. You can also assign policies based on groups. This can be found here but we haven’t tested this yet:

I hope you find this post helpful. Happy batching.

Leave a Reply