I can only retrieve the basic information of the project via the API, without finding the list of project groups and their descriptor.
I make an automaton flow that allows you to create projects on the fly. When my project is created, I want to add two steps:
You can get the project groups and find the descriptors of the project groups via the Graph Groups - List endpoint. The PAT should have the Graph read
permission.
My test PowerShell script:
# Replace with your Azure DevOps organization name, project name and PAT
$organization = ""
$projectName = "testproject"
$PAT=""
$PATGetBytes = [System.Text.Encoding]::ASCII.GetBytes(":$PAT")
$Authentication = [System.Convert]::ToBase64String($PATGetBytes)
$Headers = @{Authorization = ("Basic {0}" -f $Authentication) }
# Define the REST API endpoint
$uri = "https://vssps.dev.azure.com/$organization/_apis/graph/groups?api-version=7.2-preview.1"
# Send the GET request
$response = Invoke-RestMethod -Uri $uri -Method Get -Headers $headers
# Filter out the groups related to the specific project name
$projectGroups = $response.value | Where-Object { $_.principalName -like "*$projectName*" }
# Display the project groups descriptor
$projectGroups | Format-Table -Property @{label="Group Name";expression={$_.principalName}},@{label="descriptor";expression={$_.descriptor}}
Test result: