Groups - Create

Create a new VSTS group or materialize an existing AAD group.

The body of the request must be a derived type of GraphGroupCreationContext:

  • GraphGroupVstsCreationContext - Create a new VSTS group that is not backed by an external provider.
  • GraphGroupMailAddressCreationContext - Create a new group using the mail address as a reference to an existing group from an external AD or AAD backed provider.
  • GraphGroupOriginIdCreationContext - Create a new group using the OriginID as a reference to a group from an external AD or AAD backed provider.

Optionally, you can add the newly created group as a member of an existing VSTS group and/or specify a custom storage key for the group.

POST https://vssps.dev.azure.com/{organization}/_apis/graph/groups?api-version=5.0-preview.1
POST https://vssps.dev.azure.com/{organization}/_apis/graph/groups?scopeDescriptor={scopeDescriptor}&groupDescriptors={groupDescriptors}&api-version=5.0-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

api-version
query True

string

Version of the API to use. This should be set to '5.0-preview.1' to use this version of the api.

groupDescriptors
query

string

array (string)

A comma separated list of descriptors referencing groups you want the graph group to join

scopeDescriptor
query

string

A descriptor referencing the scope (collection, project) in which the group should be created. If omitted, will be created in the scope of the enclosing account or organization. Valid only for VSTS groups.

Request Body

Name Type Description
storageKey

string

Optional: If provided, we will use this identifier for the storage key of the created group

Responses

Name Type Description
200 OK

GraphGroup

successful operation

Security

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.graph_manage Grants the ability to read user, group, scope and group membership information, and to add users, groups and manage group memberships

Examples

Add an AAD Group as member of a group
Add an AAD Group by OID
Add an AAD Group with a custom storage key
Create a Group at the account level
Create a Group at the project level

Add an AAD Group as member of a group

Sample Request

POST https://vssps.dev.azure.com/fabrikam/_apis/graph/groups?groupDescriptors=TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtNDI4NzE1MDg5LTI0ODk3NTM0MTMtMjc5MTIyNzA3NS0yNDUyNDc1MzktMS0xMTU0Nzg2MjAyLTE2Mjc1MDU3MzEtMjE3MzU4NTE3My0yMjY2NjA3MzIz&api-version=5.0-preview.1

{
  "originId": "7dee3381-2ec2-41c2-869a-7afe9b574095"
}

Sample Response

{
  "subjectKind": "group",
  "description": "Test engineers",
  "specialType": "AzureActiveDirectoryApplicationGroup",
  "scopeId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "scopeType": "ServiceHost",
  "scopeName": "TEAM FOUNDATION",
  "localScopeId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "securingHostId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "isCrossProject": true,
  "isGlobalScope": true,
  "cuid": "f2a65f03-1688-4399-9bc0-5c041737a43c",
  "domain": "vstfs:///Framework/IdentityDomain/f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "principalName": "Testers",
  "mailAddress": null,
  "origin": "aad",
  "originId": "7dee3381-2ec2-41c2-869a-7afe9b574095",
  "displayName": "[TEAM FOUNDATION]\\Testers",
  "_links": {
    "self": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/graph/groups/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMTY3NjY0MjUzLTMyNTc4NDQyODktMjI1ODI3MDk3NC0yNjA2MTg2NjQ1"
    },
    "memberships": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/graph/memberships/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMTY3NjY0MjUzLTMyNTc4NDQyODktMjI1ODI3MDk3NC0yNjA2MTg2NjQ1"
    }
  },
  "url": "https://vssps.dev.azure.com/fabrikam/_apis/graph/groups/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMTY3NjY0MjUzLTMyNTc4NDQyODktMjI1ODI3MDk3NC0yNjA2MTg2NjQ1",
  "descriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMTY3NjY0MjUzLTMyNTc4NDQyODktMjI1ODI3MDk3NC0yNjA2MTg2NjQ1"
}

Add an AAD Group by OID

Sample Request

POST https://vssps.dev.azure.com/fabrikam/_apis/graph/groups?api-version=5.0-preview.1

{
  "originId": "77ed2186-aaf6-4299-ac9e-37ba282c2b95"
}

Sample Response

{
  "subjectKind": "group",
  "description": "Full time employees working on Fabrikam",
  "specialType": "AzureActiveDirectoryApplicationGroup",
  "scopeId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "scopeType": "ServiceHost",
  "scopeName": "TEAM FOUNDATION",
  "localScopeId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "securingHostId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "isCrossProject": true,
  "isGlobalScope": true,
  "cuid": "5f2fed65-0b55-410c-b821-e9bff685f514",
  "domain": "vstfs:///Framework/IdentityDomain/f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "principalName": "Full Time Engineers",
  "mailAddress": null,
  "origin": "aad",
  "originId": "77ed2186-aaf6-4299-ac9e-37ba282c2b95",
  "displayName": "[TEAM FOUNDATION]\\Full Time Engineers",
  "_links": {
    "self": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/graph/groups/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMjUwMzcwNDIzLTQxMzgzNzU0OTAtMjg5NjA1MDEwNi02NzM5ODMzODE"
    },
    "memberships": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/graph/memberships/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMjUwMzcwNDIzLTQxMzgzNzU0OTAtMjg5NjA1MDEwNi02NzM5ODMzODE"
    }
  },
  "url": "https://vssps.dev.azure.com/fabrikam/_apis/graph/groups/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMjUwMzcwNDIzLTQxMzgzNzU0OTAtMjg5NjA1MDEwNi02NzM5ODMzODE",
  "descriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0yMjUwMzcwNDIzLTQxMzgzNzU0OTAtMjg5NjA1MDEwNi02NzM5ODMzODE"
}

Add an AAD Group with a custom storage key

Sample Request

POST https://vssps.dev.azure.com/fabrikam/_apis/graph/groups?api-version=5.0-preview.1

{
  "originId": "f0d20172-7b96-42f6-9436-941433654b48",
  "storageKey": "07890a9a-24aa-44a1-8ca7-e8410da75c2c"
}

Sample Response

{
  "subjectKind": "group",
  "description": "Part time engineers",
  "specialType": "AzureActiveDirectoryApplicationGroup",
  "scopeId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "scopeType": "ServiceHost",
  "scopeName": "TEAM FOUNDATION",
  "localScopeId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "securingHostId": "f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "isCrossProject": true,
  "isGlobalScope": true,
  "cuid": "07890a9a-24aa-44a1-8ca7-e8410da75c2c",
  "domain": "vstfs:///Framework/IdentityDomain/f35b9015-cde8-4834-a1d5-09e8f359cb85",
  "principalName": "Part Time Engineers",
  "mailAddress": null,
  "origin": "aad",
  "originId": "f0d20172-7b96-42f6-9436-941433654b48",
  "displayName": "[TEAM FOUNDATION]\\Part Time Engineers",
  "_links": {
    "self": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/graph/groups/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0xOTEyNzIyMTYwLTI1MjQ3MDYzNzAtMjQ4NjYwNDgyMC04NjIyNzY0MjQ"
    },
    "memberships": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/graph/memberships/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0xOTEyNzIyMTYwLTI1MjQ3MDYzNzAtMjQ4NjYwNDgyMC04NjIyNzY0MjQ"
    }
  },
  "url": "https://vssps.dev.azure.com/fabrikam/_apis/graph/groups/TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0xOTEyNzIyMTYwLTI1MjQ3MDYzNzAtMjQ4NjYwNDgyMC04NjIyNzY0MjQ",
  "descriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtMTIwNDQwMDk2OS0yNDAyOTg2NDEzLTIxNzk0MDg2MTYtMy0xOTEyNzIyMTYwLTI1MjQ3MDYzNzAtMjQ4NjYwNDgyMC04NjIyNzY0MjQ"
}

Create a Group at the account level

Sample Request

POST https://vssps.dev.azure.com/fabrikam/_apis/graph/groups?api-version=5.0-preview.1

{
  "displayName": "Developers-0db1aa79-b8e8-4e33-8347-52edb8135430",
  "description": "Group created via client library"
}

Sample Response

location: https://vssps.dev.azure.com/fabrikam/_apis/Graph/Groups/vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMTc2MDU2ODQ4LTMyODAwNzczODUtMjM4NDQzMDA4Mi0yNTc3Njk3NTA4LTEtMzI3OTE4ODE5Ny0yMDg4NzA1ODY3LTI4NzE0NTI3MTUtMzY5OTQzNzgwMg
{
  "subjectKind": "group",
  "description": "Group created via client library",
  "domain": "vstfs:///Framework/IdentityDomain/10feb381-82c3-4902-8e1f-840299a48ae4",
  "principalName": "[Fabrikam]\\Developers-0db1aa79-b8e8-4e33-8347-52edb8135430",
  "mailAddress": null,
  "origin": "vsts",
  "originId": "ed315089-e94f-4dee-ba93-525120e9e21d",
  "displayName": "Developers-0db1aa79-b8e8-4e33-8347-52edb8135430",
  "_links": {
    "self": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Groups/vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMTc2MDU2ODQ4LTMyODAwNzczODUtMjM4NDQzMDA4Mi0yNTc3Njk3NTA4LTEtMzI3OTE4ODE5Ny0yMDg4NzA1ODY3LTI4NzE0NTI3MTUtMzY5OTQzNzgwMg"
    },
    "memberships": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Memberships/vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMTc2MDU2ODQ4LTMyODAwNzczODUtMjM4NDQzMDA4Mi0yNTc3Njk3NTA4LTEtMzI3OTE4ODE5Ny0yMDg4NzA1ODY3LTI4NzE0NTI3MTUtMzY5OTQzNzgwMg"
    },
    "membershipState": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/MembershipStates/vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMTc2MDU2ODQ4LTMyODAwNzczODUtMjM4NDQzMDA4Mi0yNTc3Njk3NTA4LTEtMzI3OTE4ODE5Ny0yMDg4NzA1ODY3LTI4NzE0NTI3MTUtMzY5OTQzNzgwMg"
    },
    "storageKey": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/StorageKeys/vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMTc2MDU2ODQ4LTMyODAwNzczODUtMjM4NDQzMDA4Mi0yNTc3Njk3NTA4LTEtMzI3OTE4ODE5Ny0yMDg4NzA1ODY3LTI4NzE0NTI3MTUtMzY5OTQzNzgwMg"
    }
  },
  "url": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Groups/vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMTc2MDU2ODQ4LTMyODAwNzczODUtMjM4NDQzMDA4Mi0yNTc3Njk3NTA4LTEtMzI3OTE4ODE5Ny0yMDg4NzA1ODY3LTI4NzE0NTI3MTUtMzY5OTQzNzgwMg",
  "descriptor": "vssgp.Uy0xLTktMTU1MTM3NDI0NS0yMTc2MDU2ODQ4LTMyODAwNzczODUtMjM4NDQzMDA4Mi0yNTc3Njk3NTA4LTEtMzI3OTE4ODE5Ny0yMDg4NzA1ODY3LTI4NzE0NTI3MTUtMzY5OTQzNzgwMg"
}

Create a Group at the project level

Sample Request

POST https://vssps.dev.azure.com/fabrikam/_apis/graph/groups?scopeDescriptor=scp.NTc0N2FkNjQtMTE3Ni00MzM4LWE1OGMtOTIyZGJiOGVlOTRk&api-version=5.0-preview.1

{
  "displayName": "Project Developers-012a4748-c8e2-4518-9b91-cec6e425b376",
  "description": "Group at project level created via client library"
}

Sample Response

location: https://vssps.dev.azure.com/fabrikam/_apis/Graph/Groups/vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNjg5MDc3NTkxLTE5ODA4NDAwMDMtMjc3NzQ1MzEwMS0zMTQ2NzA1MjI5LTEtMTUwOTU5MTI1MC0zOTMyNzU1OS0yNzU0Nzg2Njk0LTEwMzkyMjQ3Nzg
{
  "subjectKind": "group",
  "description": "Group at project level created via client library",
  "domain": "vstfs:///Classification/TeamProject/ca97818a-3c86-4f95-b591-a4263b656b9e",
  "principalName": "[fabrikam-fiber]\\Project Developers-012a4748-c8e2-4518-9b91-cec6e425b376",
  "mailAddress": null,
  "origin": "vsts",
  "originId": "de80dedc-2637-49d2-82a9-ac38d8a92ae5",
  "displayName": "Project Developers-012a4748-c8e2-4518-9b91-cec6e425b376",
  "_links": {
    "self": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Groups/vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNjg5MDc3NTkxLTE5ODA4NDAwMDMtMjc3NzQ1MzEwMS0zMTQ2NzA1MjI5LTEtMTUwOTU5MTI1MC0zOTMyNzU1OS0yNzU0Nzg2Njk0LTEwMzkyMjQ3Nzg"
    },
    "memberships": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Memberships/vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNjg5MDc3NTkxLTE5ODA4NDAwMDMtMjc3NzQ1MzEwMS0zMTQ2NzA1MjI5LTEtMTUwOTU5MTI1MC0zOTMyNzU1OS0yNzU0Nzg2Njk0LTEwMzkyMjQ3Nzg"
    },
    "membershipState": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/MembershipStates/vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNjg5MDc3NTkxLTE5ODA4NDAwMDMtMjc3NzQ1MzEwMS0zMTQ2NzA1MjI5LTEtMTUwOTU5MTI1MC0zOTMyNzU1OS0yNzU0Nzg2Njk0LTEwMzkyMjQ3Nzg"
    },
    "storageKey": {
      "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/StorageKeys/vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNjg5MDc3NTkxLTE5ODA4NDAwMDMtMjc3NzQ1MzEwMS0zMTQ2NzA1MjI5LTEtMTUwOTU5MTI1MC0zOTMyNzU1OS0yNzU0Nzg2Njk0LTEwMzkyMjQ3Nzg"
    }
  },
  "url": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Groups/vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNjg5MDc3NTkxLTE5ODA4NDAwMDMtMjc3NzQ1MzEwMS0zMTQ2NzA1MjI5LTEtMTUwOTU5MTI1MC0zOTMyNzU1OS0yNzU0Nzg2Njk0LTEwMzkyMjQ3Nzg",
  "descriptor": "vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNjg5MDc3NTkxLTE5ODA4NDAwMDMtMjc3NzQ1MzEwMS0zMTQ2NzA1MjI5LTEtMTUwOTU5MTI1MC0zOTMyNzU1OS0yNzU0Nzg2Njk0LTEwMzkyMjQ3Nzg"
}

Definitions

Name Description
GraphGroup

Graph group entity

GraphGroupCreationContext

Do not attempt to use this type to create a new group. This type does not contain sufficient fields to create a new group.

ReferenceLinks

The class to represent a collection of REST reference links.

GraphGroup

Graph group entity

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

description

string

A short phrase to help human readers disambiguate groups with similar names

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

domain

string

This represents the name of the container of origin for a graph member. (For MSA this is "Windows Live ID", for AD the name of the domain, for AAD the tenantID of the directory, for VSTS groups the ScopeId, etc)

legacyDescriptor

string

[Internal Use Only] The legacy descriptor is here in case you need to access old version IMS using identity descriptor.

mailAddress

string

The email address of record for a given graph member. This may be different than the principal name.

origin

string

The type of source provider for the origin identifier (ex:AD, AAD, MSA)

originId

string

The unique identifier from the system of origin. Typically a sid, object id or Guid. Linking and unlinking operations can cause this value to change for a user because the user is not backed by a different provider and has a different unique id in the new provider.

principalName

string

This is the PrincipalName of this graph member from the source provider. The source provider may change this field over time and it is not guaranteed to be immutable for the life of the graph member by VSTS.

subjectKind

string

This field identifies the type of the graph subject (ex: Group, Scope, User).

url

string

This url is the full route to the source resource of this graph subject.

GraphGroupCreationContext

Do not attempt to use this type to create a new group. This type does not contain sufficient fields to create a new group.

Name Type Description
storageKey

string

Optional: If provided, we will use this identifier for the storage key of the created group

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.