|
| 1 | +--- |
| 2 | +applicable: Microsoft Teams |
| 3 | +author: pavellatif |
| 4 | +external help file: Microsoft.Teams.ConfigAPI.Cmdlets-help.xml |
| 5 | +Locale: en-US |
| 6 | +manager: roykuntz |
| 7 | +Module Name: MicrosoftTeams |
| 8 | +ms.author: pavellatif |
| 9 | +ms.reviewer: pavellatif |
| 10 | +online version: https://learn.microsoft.com/powershell/module/microsoftteams/get-csphonenumberpolicyassignment |
| 11 | +schema: 2.0.0 |
| 12 | +title: Get-CsPhoneNumberPolicyAssignment |
| 13 | +--- |
| 14 | + |
| 15 | +# Get-CsPhoneNumberPolicyAssignment |
| 16 | + |
| 17 | +## SYNOPSIS |
| 18 | +This cmdlet retrieves policy assignments associated with a specific telephone number or a list of telephone numbers in Microsoft Teams. |
| 19 | + |
| 20 | +## SYNTAX |
| 21 | +Policy assignment for individual telephone number: |
| 22 | +``` |
| 23 | +Get-CsPhoneNumberPolicyAssignment [-TelephoneNumber <String>] |
| 24 | + [<CommonParameters>] |
| 25 | +``` |
| 26 | + |
| 27 | +Policy assignment info for a list of numbers with specific policy. |
| 28 | +``` |
| 29 | +Get-CsPhoneNumberPolicyAssignment [-PolicyType <String>] [-PolicyName <String>] [-ResultSize <Int32>] |
| 30 | + [<CommonParameters>] |
| 31 | +``` |
| 32 | + |
| 33 | +## DESCRIPTION |
| 34 | +This cmdlet retrieves policy assignments associated with one or more telephone numbers. It supports querying a single telephone number or a list of numbers, with optional filtering by policy type or policy name. This functionality is particularly useful for administrators managing Teams voice configurations, including scenarios with multiline support. |
| 35 | + |
| 36 | +When querying a single telephone number, the cmdlet returns the most recent effective policy assignment. Note that it may take several minutes for newly applied assignments to propagate and appear in the results. |
| 37 | + |
| 38 | +## EXAMPLES |
| 39 | + |
| 40 | +### Example 1 |
| 41 | +Policy assignment for individual telephone number |
| 42 | + |
| 43 | +```powershell |
| 44 | +PS C:\> Get-CsPhoneNumberPolicyAssignment -TelephoneNumber 17789493766 |
| 45 | +``` |
| 46 | +```output |
| 47 | +TelephoneNumber PolicyType PolicyName Authority AssignmentType Reference |
| 48 | +--------------- ---------- ---------- --------- -------------- --------- |
| 49 | +17789493766 TenantDialPlan PolicyFoo Tenant Direct Direct |
| 50 | +17789493766 CallingLineIdentity PolicyBar Tenant Direct Direct |
| 51 | +``` |
| 52 | +This example returns all policy assigned for the specified telephone number. |
| 53 | + |
| 54 | + |
| 55 | +### Example 2 |
| 56 | +List of telephone numbers with any policy assigned |
| 57 | + |
| 58 | +```powershell |
| 59 | +PS C:\> Get-CsPhoneNumberPolicyAssignment |
| 60 | +``` |
| 61 | +```output |
| 62 | +TelephoneNumber PolicyType PolicyName Authority AssignmentType Reference |
| 63 | +--------------- ---------- ---------- --------- -------------- --------- |
| 64 | +1234567 TenantDialPlan BenTestPolicy Tenant Direct Direct |
| 65 | +17789493766 TenantDialPlan PolicyFoo Tenant Direct Direct |
| 66 | +17789493766 CallingLineIdentity PolicyBar Tenant Direct Direct |
| 67 | +``` |
| 68 | +This example returns a list of all the telephone numbers in the tenant that have at least one policy assigned. |
| 69 | + |
| 70 | +### Example 3 |
| 71 | +Policy assignment info for a list of numbers with specific policy type |
| 72 | + |
| 73 | +```powershell |
| 74 | +PS C:\> Get-CsPhoneNumberPolicyAssignment -PolicyType TenantDialPlan |
| 75 | +``` |
| 76 | +```output |
| 77 | +TelephoneNumber PolicyType PolicyName Reference |
| 78 | +--------------- ---------- ---------- --------- |
| 79 | +1234567 TenantDialPlan BenTestPolicy Direct |
| 80 | +17789493766 TenantDialPlan PolicyFoo Direct |
| 81 | +``` |
| 82 | +This example returns a list of all the telephone numbers in tenant that have TenantDialPlan assigned. |
| 83 | + |
| 84 | +### Example 4 |
| 85 | +Policy assignment info for a list of numbers filtered by policy type, policy name, and count |
| 86 | + |
| 87 | +```powershell |
| 88 | +PS C:\> Get-CsPhoneNumberPolicyAssignment -PolicyType TenantDialPlan -PolicyName PolicyFoo -ResultSize 1 |
| 89 | +``` |
| 90 | +```output |
| 91 | +TelephoneNumber PolicyType PolicyName Reference |
| 92 | +--------------- ---------- ---------- --------- |
| 93 | +17789493766 TenantDialPlan PolicyFoo Direct |
| 94 | +``` |
| 95 | +This example returns the top 1 telephone number with policy assignment matching the specified type and name. |
| 96 | + |
| 97 | + |
| 98 | +## PARAMETERS |
| 99 | + |
| 100 | +### -TelephoneNumber |
| 101 | +Specifies the telephone number to query. |
| 102 | + |
| 103 | +```yaml |
| 104 | +Type: System.String |
| 105 | +Parameter Sets: (All) |
| 106 | +Aliases: Identity |
| 107 | + |
| 108 | +Required: False |
| 109 | +Position: Named |
| 110 | +Default value: None |
| 111 | +Accept pipeline input: False |
| 112 | +Accept wildcard characters: False |
| 113 | +``` |
| 114 | +
|
| 115 | +### -PolicyType |
| 116 | +Filters results by the type of policy assigned (e.g., TenantDialPlan, CallingLineIdentity etc.). |
| 117 | +
|
| 118 | +```yaml |
| 119 | +Type: System.String |
| 120 | +Parameter Sets: (All) |
| 121 | +Aliases: |
| 122 | + |
| 123 | +Required: False |
| 124 | +Position: Named |
| 125 | +Default value: None |
| 126 | +Accept pipeline input: False |
| 127 | +Accept wildcard characters: False |
| 128 | +``` |
| 129 | +
|
| 130 | +### -PolicyName |
| 131 | +Filters results by the name of the policy. |
| 132 | +To use this parameter, `-PolicyType` must also be specified. |
| 133 | + |
| 134 | +```yaml |
| 135 | +Type: System.String |
| 136 | +Parameter Sets: (All) |
| 137 | +Aliases: |
| 138 | +
|
| 139 | +Required: False |
| 140 | +Position: Named |
| 141 | +Default value: None |
| 142 | +Accept pipeline input: False |
| 143 | +Accept wildcard characters: False |
| 144 | +``` |
| 145 | + |
| 146 | +### -ResultSize |
| 147 | +Limits the number of telephone numbers returned in the results. |
| 148 | + |
| 149 | +```yaml |
| 150 | +Type: System.Int32 |
| 151 | +Parameter Sets: (All) |
| 152 | +Aliases: |
| 153 | +
|
| 154 | +Required: False |
| 155 | +Position: Named |
| 156 | +Default value: None |
| 157 | +Accept pipeline input: False |
| 158 | +Accept wildcard characters: False |
| 159 | +``` |
| 160 | + |
| 161 | +### CommonParameters |
| 162 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). |
| 163 | + |
| 164 | +## INPUTS |
| 165 | + |
| 166 | +### None |
| 167 | + |
| 168 | +## OUTPUTS |
| 169 | + |
| 170 | +### TelephoneNumber |
| 171 | +The telephone number. |
| 172 | + |
| 173 | +### PolicyType |
| 174 | +The type of the policy assigned to the telephone number. |
| 175 | + |
| 176 | +### PolicyName |
| 177 | +The name of the policy assigned to the telephone number. |
| 178 | + |
| 179 | +### Reference |
| 180 | +Metadata that describes the origin or mechanism of the policy assignment. It helps administrators understand whether a policy was explicitly set or inherited through broader configuration scopes. This cmdlet returns only Direct assignments, which are policies that are explicitly assigned to telephone numbers by a tenant admin. |
| 181 | + |
| 182 | +## NOTES |
| 183 | +The cmdlet is available in Teams PowerShell module 7.3.1 or later. |
| 184 | +The cmdlet is only available in commercial cloud instances. |
| 185 | + |
| 186 | +## RELATED LINKS |
| 187 | + |
| 188 | +[Set-CsPhoneNumberPolicyAssignment](./set-csphonenumberpolicyassignment.md) |
0 commit comments