Skip to content

Commit 5b4828b

Browse files
committed
Adding new cmdlets for telephone number specific policies
1 parent fc5865a commit 5b4828b

File tree

2 files changed

+313
-0
lines changed

2 files changed

+313
-0
lines changed
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
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)
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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/set-csphonenumberpolicyassignment
11+
schema: 2.0.0
12+
title: Set-CsPhoneNumberPolicyAssignment
13+
---
14+
15+
# Set-CsPhoneNumberPolicyAssignment
16+
17+
## SYNOPSIS
18+
This cmdlet assigns a policy to a specific telephone number in Microsoft Teams.
19+
20+
## SYNTAX
21+
```
22+
Set-CsPhoneNumberPolicyAssignment [-TelephoneNumber <String>] [-PolicyType <String>] [-PolicyName <String>]
23+
[<CommonParameters>]
24+
```
25+
26+
## DESCRIPTION
27+
The cmdlet assigns a policy to a telephone number in Microsoft Teams. This is useful in multi-line scenarios or when managing voice configurations for users who require specific dial plans or calling policies for different telephone numbers.
28+
29+
Please note that policies must be pre-created and available in the tenant before assignment. The list of policies that can be assigned to telephone numbers are:
30+
- CallingLineIdentity
31+
- OnlineDialOutPolicy
32+
- OnlineVoiceRoutingPolicy
33+
- TeamsEmergencyCallingPolicy
34+
- TeamsEmergencyCallRoutingPolicy
35+
- TeamsSharedCallingRoutingPolicy
36+
- TenantDialPlan
37+
38+
Assignments are effective immediately, but may take a few minutes to propagate and show up in results in [Get-CsPhoneNumberPolicyAssignment](./get-csphonenumberpolicyassignment.md) cmdlet.
39+
40+
41+
## EXAMPLES
42+
43+
### Example 1
44+
```powershell
45+
PS C:\> Set-CsPhoneNumberPolicyAssignment -TelephoneNumber 17789493766 -PolicyType TenantDialPlan -PolicyName "US Admins Dial Plan"
46+
```
47+
This example assigns a policy to the specified telephone number.
48+
49+
### Example 2
50+
```powershell
51+
PS C:\> Set-CsPhoneNumberPolicyAssignment -TelephoneNumber 17789493766 -PolicyType TenantDialPlan
52+
```
53+
This example removes an existing TenantDialPlan previously assigned to the specified telephone number.
54+
55+
56+
## PARAMETERS
57+
58+
### -TelephoneNumber
59+
Specifies the telephone number to which the policy will be assigned.
60+
61+
```yaml
62+
Type: System.String
63+
Parameter Sets: (All)
64+
Aliases: Identity
65+
66+
Required: True
67+
Position: Named
68+
Default value: None
69+
Accept pipeline input: False
70+
Accept wildcard characters: False
71+
```
72+
73+
### -PolicyType
74+
Indicates the type of policy being assigned.
75+
76+
```yaml
77+
Type: System.String
78+
Parameter Sets: (All)
79+
Aliases:
80+
81+
Required: True
82+
Position: Named
83+
Default value: None
84+
Accept pipeline input: False
85+
Accept wildcard characters: False
86+
```
87+
88+
### -PolicyName
89+
The name of the policy to assign. This must match an existing policy configured in the tenant.
90+
91+
If the telephone number already has a different policy of the same PolicyType assigned, then this will replace the existing policy assignment.
92+
93+
If PolicyName is not provided, then it would remove any existing policy of the same PolicyType previously assigned to the specified phone number.
94+
95+
```yaml
96+
Type: System.String
97+
Parameter Sets: (All)
98+
Aliases:
99+
100+
Required: False
101+
Position: Named
102+
Default value: None
103+
Accept pipeline input: False
104+
Accept wildcard characters: False
105+
```
106+
107+
### CommonParameters
108+
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).
109+
110+
## INPUTS
111+
112+
### None
113+
114+
## OUTPUTS
115+
116+
This cmdlet does not return output on success. Errors are thrown if the assignment fails due to invalid parameters, missing policies, or internal service issues.
117+
118+
If you want to verify the outcome of the assignment, call `Get-CsPhoneNumberPolicyAssignment -TelephoneNumber <YourPhoneNumber>`.
119+
120+
## NOTES
121+
The cmdlet is available in Teams PowerShell module 7.3.1 or later.
122+
The cmdlet is only available in commercial cloud instances.
123+
124+
## RELATED LINKS
125+
[Get-CsPhoneNumberPolicyAssignment](./get-csphonenumberpolicyassignment.md)

0 commit comments

Comments
 (0)