diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf0755..1386b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,6 @@ All notable changes to this project will be documented in this file.
--> - ## [UNRELEASED] ### Summary @@ -27,6 +26,7 @@ All notable changes to this project will be documented in this file. ### What's Changed - feat(Get-AdoUser): Add user support (#124) +- feat(Get-AdoGroup): Add `domain` property to output (#126) - fix(Get-AdoUserEntitlement): Correct error handling (#128) ### Breaking Changes diff --git a/docs/Get-AdoGroup.md b/docs/Get-AdoGroup.md index 343d987..d26571a 100644 --- a/docs/Get-AdoGroup.md +++ b/docs/Get-AdoGroup.md @@ -2,9 +2,9 @@ document type: cmdlet external help file: Azure.DevOps.PSModule-Help.xml HelpUri: https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/groups/list -Locale: en-NL +Locale: nl-NL Module Name: Azure.DevOps.PSModule -ms.date: 01/02/2026 +ms.date: 02-14-2026 PlatyPS schema version: 2024-05-01 title: Get-AdoGroup --> @@ -20,12 +20,18 @@ Get a single or multiple groups in an Azure DevOps organization. ## SYNTAX -### __AllParameterSets +### ListGroups (Default) -```text -Get-AdoGroup [[-CollectionUri] ] [[-ScopeDescriptor] ] [[-SubjectTypes] ] - [[-Name] ] [[-GroupDescriptor] ] [[-Version] ] - [-WhatIf] [-Confirm] [] +```powershell +Get-AdoGroup [-CollectionUri ] [-ScopeDescriptor ] [-SubjectTypes ] + [-Name ] [-Version ] [] +``` + +### ByDescriptor + +```powershell +Get-AdoGroup [-CollectionUri ] [-GroupDescriptor ] [-Version ] + [] ``` ## ALIASES @@ -58,7 +64,7 @@ $project = Get-AdoProject -Name 'my-project-1' $projectDescriptor = (Get-AdoDescriptor -StorageKey $project.Id) $params = @{ - CollectionUri = 'https://dev.azure.com/my-org' + CollectionUri = 'https://dev.azure.com/my-org' ScopeDescriptor = $projectDescriptor SubjectTypes = 'vssgp' } @@ -74,7 +80,7 @@ Retrieves all groups in the specified project with subject types 'vssgp'. ```powershell $params = @{ SubjectTypes = 'vssgp' - ScopeDescriptor = $prjDscr + ScopeDescriptor = $projectDescriptor Name = @( 'Project Administrators', 'Contributors' @@ -123,10 +129,10 @@ AcceptedValues: [] HelpMessage: '' ``` -### -ScopeDescriptor +### -GroupDescriptor Optional. -Specify a non-default scope (collection, project) to search for groups. +The descriptor of a specific group to retrieve. When provided, retrieves a single group by its descriptor. ```yaml Type: System.String @@ -134,10 +140,10 @@ DefaultValue: '' SupportsWildcards: false Aliases: [] ParameterSets: -- Name: (All) +- Name: ByDescriptor Position: Named IsRequired: false - ValueFromPipeline: false + ValueFromPipeline: true ValueFromPipelineByPropertyName: true ValueFromRemainingArguments: false DontShow: false @@ -145,43 +151,41 @@ AcceptedValues: [] HelpMessage: '' ``` -### -SubjectTypes +### -Name Optional. -A comma separated list of user subject subtypes to reduce the retrieved results, e.g. Microsoft.IdentityModel.Claims.ClaimsIdentity +A group's display name to filter the retrieved results. +Supports wildcards for pattern matching. ```yaml Type: System.String[] -DefaultValue: ('vssgp', 'aadgp') +DefaultValue: '' SupportsWildcards: false -Aliases: [] +Aliases: +- DisplayName +- GroupName ParameterSets: -- Name: (All) +- Name: ListGroups Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: true ValueFromRemainingArguments: false DontShow: false -AcceptedValues: -- vssgp -- aadgp +AcceptedValues: [] HelpMessage: '' ``` -### -Name +### -ScopeDescriptor Optional. -A group's display name to filter the retrieved results. -Supports wildcards for pattern matching. +Specify a non-default scope (collection, project) to search for groups. ```yaml -Type: System.String[] +Type: System.String DefaultValue: '' SupportsWildcards: false -Aliases: -- DisplayName -- GroupName +Aliases: [] ParameterSets: - Name: ListGroups Position: Named @@ -194,22 +198,22 @@ AcceptedValues: [] HelpMessage: '' ``` -### -GroupDescriptor +### -SubjectTypes Optional. -The descriptor of a specific group to retrieve. -When provided, retrieves a single group by its descriptor. +A comma separated list of user subject subtypes to reduce the retrieved results, e.g. +Microsoft.IdentityModel.Claims.ClaimsIdentity ```yaml -Type: System.String -DefaultValue: '' +Type: System.String[] +DefaultValue: "@('vssgp', 'aadgp')" SupportsWildcards: false Aliases: [] ParameterSets: -- Name: ByDescriptor +- Name: ListGroups Position: Named IsRequired: false - ValueFromPipeline: true + ValueFromPipeline: false ValueFromPipelineByPropertyName: true ValueFromRemainingArguments: false DontShow: false diff --git a/src/Azure.DevOps.PSModule/Public/Graph/Groups/Get-AdoGroup.ps1 b/src/Azure.DevOps.PSModule/Public/Graph/Groups/Get-AdoGroup.ps1 index 3d861bf..56501df 100644 --- a/src/Azure.DevOps.PSModule/Public/Graph/Groups/Get-AdoGroup.ps1 +++ b/src/Azure.DevOps.PSModule/Public/Graph/Groups/Get-AdoGroup.ps1 @@ -16,10 +16,13 @@ Optional. A comma separated list of user subject subtypes to reduce the retrieved results, e.g. Microsoft.IdentityModel.Claims.ClaimsIdentity .PARAMETER Name - Optional. A group's display name to filter the retrieved results. + Optional. A group's display name to filter the retrieved results. Supports wildcards for pattern matching. + + .PARAMETER GroupDescriptor + Optional. The descriptor of a specific group to retrieve. When provided, retrieves a single group by its descriptor. .PARAMETER Version - The API version to use. Default is '7.2-preview.1'. + The API version to use for the request. Default is '7.2-preview.1'. The -preview flag must be supplied in the api-version for this request to work. .OUTPUTS @@ -39,7 +42,7 @@ $projectDescriptor = (Get-AdoDescriptor -StorageKey $project.Id) $params = @{ - CollectionUri = 'https://dev.azure.com/my-org' + CollectionUri = 'https://dev.azure.com/my-org' ScopeDescriptor = $projectDescriptor SubjectTypes = 'vssgp' } @@ -167,13 +170,14 @@ foreach ($g_ in $groups) { $obj = [ordered]@{ - displayName = $g_.displayName - originId = $g_.originId - principalName = $g_.principalName - origin = $g_.origin subjectKind = $g_.subjectKind description = $g_.description + domain = $g_.domain + principalName = $g_.principalName mailAddress = $g_.mailAddress + origin = $g_.origin + originId = $g_.originId + displayName = $g_.displayName descriptor = $g_.descriptor collectionUri = $CollectionUri } diff --git a/src/Azure.DevOps.PSModule/Tests/Graph/Groups/Get-AdoGroup.Tests.ps1 b/src/Azure.DevOps.PSModule/Tests/Graph/Groups/Get-AdoGroup.Tests.ps1 index bee3e46..380d737 100644 --- a/src/Azure.DevOps.PSModule/Tests/Graph/Groups/Get-AdoGroup.Tests.ps1 +++ b/src/Azure.DevOps.PSModule/Tests/Graph/Groups/Get-AdoGroup.Tests.ps1 @@ -18,24 +18,26 @@ Describe 'Get-AdoGroup' { $mockScopeDescriptor = 'scp.00000000-0000-0000-0000-000000000002' $mockGroup1 = [PSCustomObject]@{ - displayName = 'Project Administrators' - originId = '00000000-0000-0000-0000-000000000001' - principalName = '[TestProject]\Project Administrators' - origin = 'vsts' subjectKind = 'group' description = 'Admin group' - mailAddress = '' + domain = 'vstfs://Classification/TeamProject/00000000-0000-0000-0000-000000000001' + principalName = '[TestProject]\Project Administrators' + mailAddress = $null + origin = 'vsts' + originId = '00000000-0000-0000-0000-000000000001' + displayName = 'Project Administrators' descriptor = 'vssgp.00000000-0000-0000-0000-000000000001' } $mockGroup2 = [PSCustomObject]@{ - displayName = 'Contributors' - originId = '00000000-0000-0000-0000-000000000002' - principalName = '[TestProject]\Contributors' - origin = 'vsts' subjectKind = 'group' description = 'Contributor group' - mailAddress = '' + domain = 'vstfs://Classification/TeamProject/00000000-0000-0000-0000-000000000002' + principalName = '[TestProject]\Contributors' + mailAddress = $null + origin = 'vsts' + originId = '00000000-0000-0000-0000-000000000002' + displayName = 'Contributors' descriptor = 'vssgp.00000000-0000-0000-0000-000000000002' } @@ -66,11 +68,14 @@ Describe 'Get-AdoGroup' { $result = Get-AdoGroup -CollectionUri $mockCollectionUri # Assert - $result[0].PSObject.Properties.Name | Should -Contain 'displayName' - $result[0].PSObject.Properties.Name | Should -Contain 'originId' + $result[0].PSObject.Properties.Name | Should -Contain 'subjectKind' + $result[0].PSObject.Properties.Name | Should -Contain 'description' + $result[0].PSObject.Properties.Name | Should -Contain 'domain' $result[0].PSObject.Properties.Name | Should -Contain 'principalName' + $result[0].PSObject.Properties.Name | Should -Contain 'mailAddress' $result[0].PSObject.Properties.Name | Should -Contain 'origin' - $result[0].PSObject.Properties.Name | Should -Contain 'subjectKind' + $result[0].PSObject.Properties.Name | Should -Contain 'originId' + $result[0].PSObject.Properties.Name | Should -Contain 'displayName' $result[0].PSObject.Properties.Name | Should -Contain 'descriptor' $result[0].PSObject.Properties.Name | Should -Contain 'collectionUri' }