-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathNew-PSURole.txt
More file actions
220 lines (158 loc) · 8.52 KB
/
New-PSURole.txt
File metadata and controls
220 lines (158 loc) · 8.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
NAME
New-PSURole
SYNOPSIS
Defines a new role within PowerShell Universal.
SYNTAX
New-PSURole [-AppToken <String>] [-ComputerName <String>] [-Description <String>] -Name <String> [-Policy <ScriptBlock>] [-UseDefaultCredentials] [-Integrated] [-Disabled] [-DefaultRoute <String>] [-Roles <String[]>] [-Credential <PSCredential>] [-Permissions <String[]>] [-TrustCertificate] [-Priority <Int32>] [<CommonParameters>]
New-PSURole [-AppToken <String>] [-ComputerName <String>] [-Description <String>] -Name <String> [-UseDefaultCredentials] [-Integrated] -ClaimType <String> -ClaimValue <String> [-Disabled] [-DefaultRoute <String>] [-Roles <String[]>] [-Credential <PSCredential>] [-Permissions <String[]>] [-TrustCertificate] [-Priority <Int32>] [<CommonParameters>]
DESCRIPTION
Defines a new role within PowerShell Universal. Roles are used to define authorization within the PowerShell Universal platform. Roles can be assigned statically to an Identity or can be assigned by the -Policy script block. The policy script block receives a $User parameter that contains the identity information and claims that an identity has been granted during authentication.
Policy script blocks need to return either $true or $false to determine whether this particular identity should be provided the role.
Roles configurations are stored in .universal/roles.ps1
You can also use this cmdlet to create roles through the REST API.
PARAMETERS
-AppToken <String>
The AppToken that is used for calling the PowerShell Universal Management API. You can also call Connect-PSUServer before calling this cmdlet to set the AppToken for the entire session.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ComputerName <String>
Specifies the computer name or URL that should be called when accessing the PowerShell Universal Management API. You can also use Connect-PSUServer before calling this cmdlet to set the computer name for the entire session.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases Uri
Accept wildcard characters? false
-Description <String>
The description of this role to show within the Admin Console.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Name <String>
The name of this role. The name is used for both display and for assigning resources like APIs and dashboards.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Policy <ScriptBlock>
The policy script block to execute when determining whether to assign this role.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-UseDefaultCredentials [<SwitchParameter>]
Use default credentials when connecting to the management API
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Integrated [<SwitchParameter>]
Executes the command internally rather than using the Management API. Only works when running script from within PowerShell Universal.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ClaimType <String>
The claim type to map for this role. See Role to Claim mapping in our documentation.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-ClaimValue <String>
The claim value to map for this role. See Role to Claim mapping in our documentation.
Required? true
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Disabled [<SwitchParameter>]
Whether the role is disabled.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-DefaultRoute <String>
The default URL to forward users in this role to.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Roles <String[]>
Child roles that should be assigned to the users that are assigned this role.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Credential <PSCredential>
Credentials to login to the PowerShell Universal Management API.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Permissions <String[]>
Permissions assigned to users that are granted this role.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-TrustCertificate [<SwitchParameter>]
Whether the cmdlet should ignore certificate issues.
Required? false
Position? named
Default value False
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
-Priority <Int32>
The priority of this role. Determines which redirect to use when multiple roles are assigned to a user.
Required? false
Position? named
Default value None
Accept pipeline input? False
Aliases none
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
OUTPUTS
System.Object
NOTES
-------------------------- Example 1 --------------------------
New-PSURole -Name 'Developers' -Policy {
param($User)
$User.Claims.HasClaim('myGroup')
}
Creates a new role with a policy defined that checks to see if the user's claim contains the 'myGroup' claim.
RELATED LINKS