Skip to content

Commit 4f30f1b

Browse files
Get-ADOPermission: Support for ServiceEndpoints (Fixing #137)
1 parent e4ade9b commit 4f30f1b

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Get-ADOPermission.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
# If this is provided without anything else, will get permissions for the projectID
5252
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='Project')]
5353
[Parameter(ValueFromPipelineByPropertyName,ParameterSetName='Analytics')]
54+
[Parameter(ValueFromPipelineByPropertyName,ParameterSetName='EndpointID')]
5455
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='AreaPath')]
5556
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='Dashboard')]
5657
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='Tagging')]
@@ -121,6 +122,18 @@
121122
[switch]
122123
$Dashboard,
123124

125+
126+
# If set, will get all service endpoints permissions.
127+
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='ServiceEndpoint')]
128+
[Alias('ServiceEndpoints')]
129+
[switch]
130+
$ServiceEndpoint,
131+
132+
# If set, will get endpoint permissions related to a particular endpoint.
133+
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='EndpointID')]
134+
[string]
135+
$EndpointID,
136+
124137
# The Build Definition ID
125138
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='BuildDefinition')]
126139
[string]
@@ -319,6 +332,22 @@
319332
SecurityToken = "Plan"
320333
} + $PSBoundParameters)
321334
}
335+
'ServiceEndpoint|EndpointID' {
336+
if ($psCmdlet.ParameterSetName -eq 'ServiceEndpoint') {
337+
$PSBoundParameters['Recurse'] = $true
338+
}
339+
340+
if ($EndpointID) {
341+
$q.Enqueue(@{
342+
NamespaceID = '49b48001-ca20-4adc-8111-5b60c903a50c'
343+
SecurityToken = "endpoints/Collection/$(if ($EndpointID) {$EndpointID})"
344+
} + $PSBoundParameters)
345+
}
346+
$q.Enqueue(@{
347+
NamespaceID = '49b48001-ca20-4adc-8111-5b60c903a50c'
348+
SecurityToken = "endpoints/$(if ($ProjectID) {"$ProjectID/"})$(if ($EndpointID) {$EndpointID})"
349+
} + $PSBoundParameters)
350+
}
322351
Tagging {
323352

324353
$q.Enqueue(@{

0 commit comments

Comments
 (0)