Reputation: 331
Hello stackoverflow community. Is there a way for us to obtain the descriptor identifier of the AD User group? any rest api endpoint for that purpose? given that we know the exact name of the AD group
Thank you
Upvotes: 3
Views: 3415
Reputation: 24434
I was able to get the group descriptor by using the Azure CLI, like this:
az devops security group list --project "Your Azure DevOps Project Name Here"
That will list all of the security groups that have been assigned a role in the team project. If you don't see your group in the list, then just go add the group to one of the permission roles in the team project (e.g. Readers) and it should show up.
From there just find your group in the list and grab its descriptor
field.
Upvotes: 0
Reputation: 11
The descriptor lookup needs to happen at organization scope but with a [TEAM FOUNDATION] prefix. Using the Azure CLI with the devops
extension:
$descriptor = az-ps devops security group list --org $org --scope organization --output json --query "graphGroups[?principalName == '[TEAM FOUNDATION]\$($groupName)'].descriptor | [0]"
Upvotes: 1
Reputation: 70
I had the same problem. This was my solution:
First: Graph->List API Can get Group descriptor, like this
Second: Identities->Read Identities API
Like this: https://vssps.dev.azure.com/v-heyanhe/_apis/identities?subjectDescriptors={The descriptor From First Step}&api-version=6.0
Upvotes: 2
Reputation: 4445
Looks like you want the Graph API to list the groups and pull out the one you want. The GraphGroup object has the descriptor property.
The Samples Repo for the .net client libraries has some code to show how the api works.
/// <summary>
/// Returns all groups in account.
/// </summary>
/// <returns></returns>
[ClientSampleMethod]
public PagedGraphGroups GetAllGroups()
{
VssConnection connection = Context.Connection;
GraphHttpClient graphClient = connection.GetClient<GraphHttpClient>();
PagedGraphGroups groups = graphClient.ListGroupsAsync().Result;
foreach (var group in groups.GraphGroups)
{
LogGroup(group);
}
return groups;
}
Upvotes: 0