Identities - Read Identities

解决旧标识信息,以便与旧 API(如安全 API)一起使用

GET https://vssps.dev.azure.com/{organization}/_apis/identities?api-version=7.1
GET https://vssps.dev.azure.com/{organization}/_apis/identities?descriptors={descriptors}&identityIds={identityIds}&subjectDescriptors={subjectDescriptors}&searchFilter={searchFilter}&filterValue={filterValue}&queryMembership={queryMembership}&api-version=7.1

URI 参数

名称 必需 类型 说明
organization
path

string

Azure DevOps 组织的名称。

api-version
query True

string

要使用的 API 版本。 这应设置为“7.1”才能使用此版本的 API。

descriptors
query

string

要解析的标识描述符的逗号分隔列表

filterValue
query

string

搜索值,由 searchFilter 指定。

identityIds
query

string

要解析的存储密钥的逗号分隔列表

queryMembership
query

QueryMembership

要包含在标识中的成员身份信息。 对于任何成员身份数据,值可以是 None,也可以是 Direct 以包含标识是其成员的组以及作为此标识成员的标识(仅组)

searchFilter
query

string

要执行的搜索类型。 值可以是 AccountName(domain\alias)、DisplayName、MailAddress、General(显示名称、帐户名称或唯一名称),或 LocalGroupName(仅搜索 Azure Devops 组)。

subjectDescriptors
query

string

要解析的主题描述符的逗号分隔列表

响应

名称 类型 说明
200 OK

Identity[]

成功作

安全性

oauth2

类型: oauth2
流向: accessCode
授权 URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
令牌 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

作用域

名称 说明
vso.identity 授予读取标识和组的能力。

示例

By Email
By IdentityDescriptors
By Ids
By Name
By Subject Descriptors

By Email

示例请求

GET https://vssps.dev.azure.com/fabrikam/_apis/identities?searchFilter=General&filterValue=jtseng@vscsi.us&queryMembership=None&api-version=7.1

示例响应

{
  "count": 1,
  "value": [
    {
      "id": "81fa6389-0872-6fdd-a451-7ba7880f566a",
      "descriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;7a394543-62fd-4274-a7d2-8fac775942b6\\jtseng@vscsi.us",
      "subjectDescriptor": "aad.MDA0NzBlMzQtZGE2MS03YTY5LWJkOTYtNDg3YTg0OWVjNTU4",
      "providerDisplayName": "Jia-hao Tseng",
      "isActive": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "User"
        },
        "Description": {
          "$type": "System.String",
          "$value": ""
        },
        "Domain": {
          "$type": "System.String",
          "$value": "7a394543-62fd-4274-a7d2-8fac775942b6"
        },
        "Account": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "DN": {
          "$type": "System.String",
          "$value": ""
        },
        "Mail": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "Generic"
        },
        "Alias": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "PUID": {
          "$type": "System.String",
          "$value": "aad:100FAFF21C1B5261"
        },
        "ComplianceValidated": {
          "$type": "System.DateTime",
          "$value": "2020-04-23T00:00:00Z"
        },
        "http://schemas.microsoft.com/identity/claims/objectidentifier": {
          "$type": "System.String",
          "$value": "55c8c7b6-7ace-43bc-918f-304dfa2b6317"
        },
        "MetadataUpdateDate": {
          "$type": "System.DateTime",
          "$value": "2018-07-10T16:11:40Z"
        },
        "DirectoryAlias": {
          "$type": "System.String",
          "$value": "jtseng"
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 0
    }
  ]
}

By IdentityDescriptors

示例请求

GET https://vssps.dev.azure.com/fabrikam/_apis/identities?descriptors=Microsoft.IdentityModel.Claims.ClaimsIdentity;7a394543-62fd-4274-a7d2-8fac775942b6\jtseng@vscsi.us,Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1725938060-2279921994-2555521242-2616350130-0-0-0-0-3&queryMembership=None&api-version=7.1

示例响应

{
  "count": 2,
  "value": [
    {
      "id": "81fa6389-0872-6fdd-a451-7ba7880f566a",
      "descriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;7a394543-62fd-4274-a7d2-8fac775942b6\\jtseng@vscsi.us",
      "subjectDescriptor": "aad.MDA0NzBlMzQtZGE2MS03YTY5LWJkOTYtNDg3YTg0OWVjNTU4",
      "providerDisplayName": "Jia-hao Tseng",
      "isActive": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "User"
        },
        "Description": {
          "$type": "System.String",
          "$value": ""
        },
        "Domain": {
          "$type": "System.String",
          "$value": "7a394543-62fd-4274-a7d2-8fac775942b6"
        },
        "Account": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "DN": {
          "$type": "System.String",
          "$value": ""
        },
        "Mail": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "Generic"
        },
        "Alias": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "PUID": {
          "$type": "System.String",
          "$value": "aad:100FAFF21C1B5261"
        },
        "ComplianceValidated": {
          "$type": "System.DateTime",
          "$value": "2020-04-23T00:00:00Z"
        },
        "http://schemas.microsoft.com/identity/claims/objectidentifier": {
          "$type": "System.String",
          "$value": "55c8c7b6-7ace-43bc-918f-304dfa2b6317"
        },
        "MetadataUpdateDate": {
          "$type": "System.DateTime",
          "$value": "2018-07-10T16:11:40Z"
        },
        "DirectoryAlias": {
          "$type": "System.String",
          "$value": "jtseng"
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 0
    },
    {
      "id": "7c86b535-818b-423f-b0fd-19a2e9f32710",
      "descriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1725938060-2279921994-2555521242-2616350130-0-0-0-0-3",
      "subjectDescriptor": "vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNzI1OTM4MDYwLTIyNzk5MjE5OTQtMjU1NTUyMTI0Mi0yNjE2MzUwMTMwLTAtMC0wLTAtMw",
      "providerDisplayName": "[jtseng]\\Project Collection Valid Users",
      "isActive": true,
      "isContainer": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "Group"
        },
        "Description": {
          "$type": "System.String",
          "$value": "This application group contains all users and groups that have access to the Team Project Collection."
        },
        "Domain": {
          "$type": "System.String",
          "$value": "vstfs:///Framework/IdentityDomain/8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "Account": {
          "$type": "System.String",
          "$value": "Project Collection Valid Users"
        },
        "SecurityGroup": {
          "$type": "System.String",
          "$value": "SecurityGroup"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "EveryoneApplicationGroup"
        },
        "ScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "ScopeType": {
          "$type": "System.String",
          "$value": "ServiceHost"
        },
        "LocalScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "SecuringHostId": {
          "$type": "System.Guid",
          "$value": "e26baa74-481c-42bc-a78c-f2a89decc807"
        },
        "ScopeName": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "GlobalScope": {
          "$type": "System.String",
          "$value": "GlobalScope"
        },
        "VirtualPlugin": {
          "$type": "System.String",
          "$value": ""
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 255
    }
  ]
}

By Ids

示例请求

GET https://vssps.dev.azure.com/fabrikam/_apis/identities?identityIds=81fa638908726fdda4517ba7880f566a,7c86b535818b423fb0fd19a2e9f32710&queryMembership=None&api-version=7.1

示例响应

{
  "count": 2,
  "value": [
    {
      "id": "81fa6389-0872-6fdd-a451-7ba7880f566a",
      "descriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;7a394543-62fd-4274-a7d2-8fac775942b6\\jtseng@vscsi.us",
      "subjectDescriptor": "aad.MDA0NzBlMzQtZGE2MS03YTY5LWJkOTYtNDg3YTg0OWVjNTU4",
      "providerDisplayName": "Jia-hao Tseng",
      "isActive": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "User"
        },
        "Description": {
          "$type": "System.String",
          "$value": ""
        },
        "Domain": {
          "$type": "System.String",
          "$value": "7a394543-62fd-4274-a7d2-8fac775942b6"
        },
        "Account": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "DN": {
          "$type": "System.String",
          "$value": ""
        },
        "Mail": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "Generic"
        },
        "Alias": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "PUID": {
          "$type": "System.String",
          "$value": "aad:100FAFF21C1B5261"
        },
        "ComplianceValidated": {
          "$type": "System.DateTime",
          "$value": "2020-04-23T00:00:00Z"
        },
        "http://schemas.microsoft.com/identity/claims/objectidentifier": {
          "$type": "System.String",
          "$value": "55c8c7b6-7ace-43bc-918f-304dfa2b6317"
        },
        "MetadataUpdateDate": {
          "$type": "System.DateTime",
          "$value": "2018-07-10T16:11:40Z"
        },
        "DirectoryAlias": {
          "$type": "System.String",
          "$value": "jtseng"
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 0
    },
    {
      "id": "7c86b535-818b-423f-b0fd-19a2e9f32710",
      "descriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1725938060-2279921994-2555521242-2616350130-0-0-0-0-3",
      "subjectDescriptor": "vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNzI1OTM4MDYwLTIyNzk5MjE5OTQtMjU1NTUyMTI0Mi0yNjE2MzUwMTMwLTAtMC0wLTAtMw",
      "providerDisplayName": "[jtseng]\\Project Collection Valid Users",
      "isActive": true,
      "isContainer": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "Group"
        },
        "Description": {
          "$type": "System.String",
          "$value": "This application group contains all users and groups that have access to the Team Project Collection."
        },
        "Domain": {
          "$type": "System.String",
          "$value": "vstfs:///Framework/IdentityDomain/8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "Account": {
          "$type": "System.String",
          "$value": "Project Collection Valid Users"
        },
        "SecurityGroup": {
          "$type": "System.String",
          "$value": "SecurityGroup"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "EveryoneApplicationGroup"
        },
        "ScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "ScopeType": {
          "$type": "System.String",
          "$value": "ServiceHost"
        },
        "LocalScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "SecuringHostId": {
          "$type": "System.Guid",
          "$value": "e26baa74-481c-42bc-a78c-f2a89decc807"
        },
        "ScopeName": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "GlobalScope": {
          "$type": "System.String",
          "$value": "GlobalScope"
        },
        "VirtualPlugin": {
          "$type": "System.String",
          "$value": ""
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 255
    }
  ]
}

By Name

示例请求

GET https://vssps.dev.azure.com/fabrikam/_apis/identities?searchFilter=General&filterValue=Project Collection Valid Users&queryMembership=None&api-version=7.1

示例响应

{
  "count": 1,
  "value": [
    {
      "id": "7c86b535-818b-423f-b0fd-19a2e9f32710",
      "descriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1725938060-2279921994-2555521242-2616350130-0-0-0-0-3",
      "subjectDescriptor": "vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNzI1OTM4MDYwLTIyNzk5MjE5OTQtMjU1NTUyMTI0Mi0yNjE2MzUwMTMwLTAtMC0wLTAtMw",
      "providerDisplayName": "[jtseng]\\Project Collection Valid Users",
      "isActive": true,
      "isContainer": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "Group"
        },
        "Description": {
          "$type": "System.String",
          "$value": "This application group contains all users and groups that have access to the Team Project Collection."
        },
        "Domain": {
          "$type": "System.String",
          "$value": "vstfs:///Framework/IdentityDomain/8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "Account": {
          "$type": "System.String",
          "$value": "Project Collection Valid Users"
        },
        "SecurityGroup": {
          "$type": "System.String",
          "$value": "SecurityGroup"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "EveryoneApplicationGroup"
        },
        "ScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "ScopeType": {
          "$type": "System.String",
          "$value": "ServiceHost"
        },
        "LocalScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "SecuringHostId": {
          "$type": "System.Guid",
          "$value": "e26baa74-481c-42bc-a78c-f2a89decc807"
        },
        "ScopeName": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "GlobalScope": {
          "$type": "System.String",
          "$value": "GlobalScope"
        },
        "VirtualPlugin": {
          "$type": "System.String",
          "$value": ""
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 255
    }
  ]
}

By Subject Descriptors

示例请求

GET https://vssps.dev.azure.com/fabrikam/_apis/identities?subjectDescriptors=aad.MDA0NzBlMzQtZGE2MS03YTY5LWJkOTYtNDg3YTg0OWVjNTU4,vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNzI1OTM4MDYwLTIyNzk5MjE5OTQtMjU1NTUyMTI0Mi0yNjE2MzUwMTMwLTAtMC0wLTAtMw&queryMembership=None&api-version=7.1

示例响应

{
  "count": 2,
  "value": [
    {
      "id": "81fa6389-0872-6fdd-a451-7ba7880f566a",
      "descriptor": "Microsoft.IdentityModel.Claims.ClaimsIdentity;7a394543-62fd-4274-a7d2-8fac775942b6\\jtseng@vscsi.us",
      "subjectDescriptor": "aad.MDA0NzBlMzQtZGE2MS03YTY5LWJkOTYtNDg3YTg0OWVjNTU4",
      "providerDisplayName": "Jia-hao Tseng",
      "isActive": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "User"
        },
        "Description": {
          "$type": "System.String",
          "$value": ""
        },
        "Domain": {
          "$type": "System.String",
          "$value": "7a394543-62fd-4274-a7d2-8fac775942b6"
        },
        "Account": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "DN": {
          "$type": "System.String",
          "$value": ""
        },
        "Mail": {
          "$type": "System.String",
          "$value": "jtseng@vscsi.us"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "Generic"
        },
        "Alias": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "PUID": {
          "$type": "System.String",
          "$value": "aad:100FAFF21C1B5261"
        },
        "ComplianceValidated": {
          "$type": "System.DateTime",
          "$value": "2020-04-23T00:00:00Z"
        },
        "http://schemas.microsoft.com/identity/claims/objectidentifier": {
          "$type": "System.String",
          "$value": "55c8c7b6-7ace-43bc-918f-304dfa2b6317"
        },
        "MetadataUpdateDate": {
          "$type": "System.DateTime",
          "$value": "2018-07-10T16:11:40Z"
        },
        "DirectoryAlias": {
          "$type": "System.String",
          "$value": "jtseng"
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 0
    },
    {
      "id": "7c86b535-818b-423f-b0fd-19a2e9f32710",
      "descriptor": "Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1725938060-2279921994-2555521242-2616350130-0-0-0-0-3",
      "subjectDescriptor": "vssgp.Uy0xLTktMTU1MTM3NDI0NS0xNzI1OTM4MDYwLTIyNzk5MjE5OTQtMjU1NTUyMTI0Mi0yNjE2MzUwMTMwLTAtMC0wLTAtMw",
      "providerDisplayName": "[jtseng]\\Project Collection Valid Users",
      "isActive": true,
      "isContainer": true,
      "members": [],
      "memberOf": [],
      "memberIds": [],
      "properties": {
        "SchemaClassName": {
          "$type": "System.String",
          "$value": "Group"
        },
        "Description": {
          "$type": "System.String",
          "$value": "This application group contains all users and groups that have access to the Team Project Collection."
        },
        "Domain": {
          "$type": "System.String",
          "$value": "vstfs:///Framework/IdentityDomain/8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "Account": {
          "$type": "System.String",
          "$value": "Project Collection Valid Users"
        },
        "SecurityGroup": {
          "$type": "System.String",
          "$value": "SecurityGroup"
        },
        "SpecialType": {
          "$type": "System.String",
          "$value": "EveryoneApplicationGroup"
        },
        "ScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "ScopeType": {
          "$type": "System.String",
          "$value": "ServiceHost"
        },
        "LocalScopeId": {
          "$type": "System.Guid",
          "$value": "8cb9df66-e487-4ad9-9852-28da9bf255b2"
        },
        "SecuringHostId": {
          "$type": "System.Guid",
          "$value": "e26baa74-481c-42bc-a78c-f2a89decc807"
        },
        "ScopeName": {
          "$type": "System.String",
          "$value": "jtseng"
        },
        "GlobalScope": {
          "$type": "System.String",
          "$value": "GlobalScope"
        },
        "VirtualPlugin": {
          "$type": "System.String",
          "$value": ""
        }
      },
      "resourceVersion": 2,
      "metaTypeId": 255
    }
  ]
}

定义

名称 说明
Identity
IdentityDescriptor

标识描述符是标识类型的包装器(Windows SID、Passport),以及唯一标识符,例如 SID 或 PUID。

PropertiesCollection

类将属性包表示为键值对的集合。 接受除 DBNull 以外的所有基元类型(具有 TypeCode != TypeCode.Object的任何类型)的值。 Byte[]、Int32、Double、DateType 和 String 类型的值将保留其类型,其他基元将重新调整为 String。 Byte[] 应为 base64 编码字符串。

QueryMembership

Identity

名称 类型 说明
customDisplayName

string

标识的自定义显示名称(如果有)。 将此属性设置为空字符串将清除现有的自定义显示名称。 将此属性设置为 null 不会影响现有的持久化值(因为 null 值不会通过线路或数据库发送)

descriptor

IdentityDescriptor

标识描述符是标识类型的包装器(Windows SID、Passport),以及唯一标识符,例如 SID 或 PUID。

id

string (uuid)

标识标识符。 也称为存储密钥或 VSID

isActive

boolean

如此 如果标识具有组织中任何 Azure Devops 组的成员身份。

isContainer

boolean

如此 如果标识是组。

masterId

string (uuid)

memberIds

string[] (uuid)

标识成员的 ID(仅限组)。

memberOf

IdentityDescriptor[]

标识描述符是标识类型的包装器(Windows SID、Passport),以及唯一标识符,例如 SID 或 PUID。

members

IdentityDescriptor[]

标识描述符是标识类型的包装器(Windows SID、Passport),以及唯一标识符,例如 SID 或 PUID。

metaTypeId

integer (int32)

properties

PropertiesCollection

类将属性包表示为键值对的集合。 接受除 DBNull 以外的所有基元类型(具有 TypeCode != TypeCode.Object的任何类型)的值。 Byte[]、Int32、Double、DateType 和 String 类型的值将保留其类型,其他基元将重新调整为 String。 Byte[] 应为 base64 编码字符串。

providerDisplayName

string

由源标识提供者指定的标识的显示名称。

resourceVersion

integer (int32)

socialDescriptor

string

subjectDescriptor

string

Graph 实体的主题描述符。

uniqueUserId

integer (int32)

IdentityDescriptor

标识描述符是标识类型的包装器(Windows SID、Passport),以及唯一标识符,例如 SID 或 PUID。

名称 类型 说明
identifier

string

此标识的唯一标识符,不超过 256 个字符,这将持久保存。

identityType

string

描述符的类型(例如 Windows、Passport 等)。

PropertiesCollection

类将属性包表示为键值对的集合。 接受除 DBNull 以外的所有基元类型(具有 TypeCode != TypeCode.Object的任何类型)的值。 Byte[]、Int32、Double、DateType 和 String 类型的值将保留其类型,其他基元将重新调整为 String。 Byte[] 应为 base64 编码字符串。

名称 类型 说明
count

integer (int32)

集合中的属性计数。

item

object

keys

string[]

集合中的键集。

values

string[]

集合中的值集。

QueryMembership

说明
direct

查询将仅返回直接成员身份数据

expanded

查询将返回扩展的成员身份数据

expandedDown

查询将返回扩展的成员身份数据(仅限子级)

expandedUp

查询将返回扩展的成员身份数据(仅限父级)

none

查询不会返回任何成员身份数据