Commands › Microsoft Teams

New-CsGroupPolicyAssignment

Microsoft Teams MicrosoftTeams New-*

This cmdlet is used to assign a policy to a security group or distribution list.

Quick start script

# New-CsGroupPolicyAssignment — 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-CsGroupPolicyAssignment
$before | Format-List

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

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

Syntax

New-CsGroupPolicyAssignment -GroupId <String> -PolicyType <String> -PolicyName <String> [-Rank <Int32>]
 [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters (7)

ParameterTypeRequiredWhat it controls
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.
-GroupId String yes The ID of a batch policy assignment operation.
-PassThru SwitchParameter Returns true when the command succeeds
-PolicyName String yes The name of the policy to be assigned.
-PolicyType String yes The type of policy to be assigned.
-Rank String The rank of the policy assignment, relative to other group policy assignments for the same policy type.
-WhatIf SwitchParameter Shows what would happen if the cmdlet runs. The cmdlet is not run.

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