Commands › Microsoft Teams

New-CsBatchPolicyAssignmentOperation

Microsoft Teams MicrosoftTeams New-*

This cmdlet is used to assign or unassign a policy to a batch of users.

Quick start script

# New-CsBatchPolicyAssignmentOperation — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-MicrosoftTeams -CertificateThumbprint $thumb -ApplicationId $appId -TenantId $tenantId

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-CsBatchPolicyAssignmentOperation
$before | Format-List

# 3. Make the change (dry run first)
New-CsBatchPolicyAssignmentOperation -Identity <String> -PolicyName <String> -PolicyType <String> -WhatIf
New-CsBatchPolicyAssignmentOperation -Identity <String> -PolicyName <String> -PolicyType <String>

# 4. Verify and diff
$after = Get-CsBatchPolicyAssignmentOperation
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

New-CsBatchPolicyAssignmentOperation [-OperationName <String>] -Identity <String[]> -PolicyType <String>
 [-AdditionalParameters <Hashtable>] [-PolicyName <String>] [-Break] [-HttpPipelineAppend <SendAsyncStep[]>]
 [-HttpPipelinePrepend <SendAsyncStep[]>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>]
 [-ProxyUseDefaultCredentials] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters (11)

ParameterTypeRequiredWhat it controls
-AdditionalParameters Hashtable .
-Break SwitchParameter Wait for .NET debugger to attach
-HttpPipelineAppend SendAsyncStep[] SendAsync Pipeline Steps to be appended to the front of the pipeline
-HttpPipelinePrepend SendAsyncStep[] SendAsync Pipeline Steps to be prepended to the front of the pipeline
-Identity String yes An array of users, specified either using object IDs (guid) or SIP addresses. There is a maximum of 5,000 users per batch.
-OperationName String An optional name for the batch assignment operation.
-PolicyName String yes The name of the policy to be assigned to the users. To remove the currently assigned policy, use $null or an empty string "".
-PolicyType String yes The type of the policy to be assigned to the users. For the list of current policy types accepted by this parameter, see the Description section at the beginning of this article.
-Proxy Uri The URI for the proxy server to use
-ProxyCredential PSCredential Credentials for a proxy server to use for the remote call
-ProxyUseDefaultCredentials SwitchParameter Use the default credentials for the proxy

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.