Commands › Microsoft Teams
New-CsBatchPolicyAssignmentOperation
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)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.