Get-MSTUserPolicyAssignment
Teams: Return the policy assignments for a user
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$Identity,
[ValidateSet('CallingLineIdentity','OnlineVoiceRoutingPolicy','TeamsAppSetupPolicy','TeamsAppPermissionPolicy','TeamsCallingPolicy','TeamsCallParkPolicy','TeamsChannelsPolicy','TeamsEducationAssignmentsAppPolicy','TeamsEmergencyCallingPolicy','TeamsMeetingBroadcastPolicy','TeamsEmergencyCallRoutingPolicy','TeamsMeetingPolicy','TeamsMessagingPolicy','TeamsUpdateManagementPolicy','TeamsUpgradePolicy','TeamsVerticalPackagePolicy','TeamsVideoInteropServicePolicy','TenantDialPlan')]
[string]$PolicyType
)
Process {
try {
[hashtable]$getArgs = @{'ErrorAction' = 'Stop'; 'Identity' = $Identity}
if (-not [System.String]::IsNullOrWhiteSpace($PolicyType)) {
$getArgs.Add('PolicyType', $PolicyType)
}
$result = Get-CsUserPolicyAssignment @getArgs | Select-Object *
if ($null -eq $result) {
Write-Output "No user policy assignments found"
return
}
$result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') -PassThru -Force
}
catch { throw }
}The user that will get their assigned policies
The type of the policy to filter