Skip to content

Commit

Permalink
Get-ADOPermission: Support for ServiceEndpoints (Fixing #137)
Browse files Browse the repository at this point in the history
  • Loading branch information
StartAutomating committed Nov 18, 2021
1 parent e4ade9b commit 4f30f1b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Get-ADOPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
# If this is provided without anything else, will get permissions for the projectID
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='Project')]
[Parameter(ValueFromPipelineByPropertyName,ParameterSetName='Analytics')]
[Parameter(ValueFromPipelineByPropertyName,ParameterSetName='EndpointID')]
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='AreaPath')]
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='Dashboard')]
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='Tagging')]
Expand Down Expand Up @@ -121,6 +122,18 @@
[switch]
$Dashboard,


# If set, will get all service endpoints permissions.
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='ServiceEndpoint')]
[Alias('ServiceEndpoints')]
[switch]
$ServiceEndpoint,

# If set, will get endpoint permissions related to a particular endpoint.
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='EndpointID')]
[string]
$EndpointID,

# The Build Definition ID
[Parameter(Mandatory,ValueFromPipelineByPropertyName,ParameterSetName='BuildDefinition')]
[string]
Expand Down Expand Up @@ -319,6 +332,22 @@
SecurityToken = "Plan"
} + $PSBoundParameters)
}
'ServiceEndpoint|EndpointID' {
if ($psCmdlet.ParameterSetName -eq 'ServiceEndpoint') {
$PSBoundParameters['Recurse'] = $true
}

if ($EndpointID) {
$q.Enqueue(@{
NamespaceID = '49b48001-ca20-4adc-8111-5b60c903a50c'
SecurityToken = "endpoints/Collection/$(if ($EndpointID) {$EndpointID})"
} + $PSBoundParameters)
}
$q.Enqueue(@{
NamespaceID = '49b48001-ca20-4adc-8111-5b60c903a50c'
SecurityToken = "endpoints/$(if ($ProjectID) {"$ProjectID/"})$(if ($EndpointID) {$EndpointID})"
} + $PSBoundParameters)
}
Tagging {

$q.Enqueue(@{
Expand Down

0 comments on commit 4f30f1b

Please sign in to comment.