Service Principal Entitlements - Update Service Principal Entitlements

Edit the entitlements (License, Extensions, Projects, Teams etc) for one or more service principals.

PATCH https://vsaex.dev.azure.com/{organization}/_apis/serviceprincipalentitlements?api-version=7.1-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 '7.1-preview.1' to use this version of the api.

Request Body

Media Types: "application/json-patch+json"

Name Type Description
from

string

The path to copy from for the Move/Copy operation.

op

Operation

The patch operation

path

string

The path for the operation. In the case of an array, a zero based index can be used to specify the position in the array (e.g. /biscuits/0/name). The "-" character can be used instead of an index to insert at the end of the array (e.g. /biscuits/-).

value

object

The value for the operation. This is either a primitive or a JToken.

Responses

Name Type Description
200 OK

ServicePrincipalEntitlementOperationReference

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.memberentitlementmanagement_write Grants the ability to manage users, their licenses as well as projects and extensions they can access

Examples

Sample request

PATCH https://vsaex.dev.azure.com/{organization}/_apis/serviceprincipalentitlements?api-version=7.1-preview.1

[
  {
    "from": "",
    "op": "replace",
    "path": "/ed82811a-0890-6f7f-813e-69dd9ebd5ba3/accessLevel",
    "value": {
      "accountLicenseType": "express",
      "licensingSource": "account"
    }
  },
  {
    "from": "",
    "op": "remove",
    "path": "/ed82811a-0890-6f7f-813e-69dd9ebd5ba3/projectEntitlements/fca61097-56a1-464f-85ba-1b126cf02cd1",
    "value": ""
  },
  {
    "from": "",
    "op": "add",
    "path": "/ed82811a-0890-6f7f-813e-69dd9ebd5ba3/projectEntitlements/6fa35aad-6755-4dd7-8c69-e13f702af0f9",
    "value": {
      "group": {
        "groupType": "projectAdministrator"
      },
      "projectRef": {
        "id": "6fa35aad-6755-4dd7-8c69-e13f702af0f9"
      }
    }
  },
  {
    "from": "",
    "op": "add",
    "path": "",
    "value": {
      "accessLevel": {
        "accountLicenseType": "stakeholder"
      },
      "projectEntitlements": [
        {
          "group": {
            "groupType": "projectAdministrator"
          },
          "projectRef": {
            "id": "fca61097-56a1-464f-85ba-1b126cf02cd1"
          }
        }
      ],
      "servicePrincipal": {
        "origin": "aad",
        "originId": "00ed1ce5-4257-4bbd-946e-1b57718e203e",
        "subjectKind": "servicePrincipal"
      }
    }
  }
]

Sample response

{
  "id": "cba1141f-6471-437e-8c6c-79a08813f247",
  "status": "succeeded",
  "haveResultsSucceeded": true,
  "completed": true,
  "results": [
    {
      "servicePrincipalId": "ed82811a-0890-6f7f-813e-69dd9ebd5ba3",
      "isSuccess": true,
      "errors": [],
      "result": {
        "servicePrincipal": {
          "subjectKind": "servicePrincipal",
          "applicationId": "d1a24244-f6cc-488b-bca7-42eb10f13c5b",
          "metaType": "application",
          "directoryAlias": "00ed1ce5-4257-4bbd-946e-1b57718e203e",
          "domain": "faab4a73-0db3-4a5e-8e8a-02188f1d3f4b",
          "principalName": "00ed1ce5-4257-4bbd-946e-1b57718e203e",
          "mailAddress": null,
          "origin": "aad",
          "originId": "00ed1ce5-4257-4bbd-946e-1b57718e203e",
          "displayName": "Service principal",
          "_links": {
            "self": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/ServicePrincipals/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "memberships": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Memberships/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "membershipState": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/MembershipStates/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "storageKey": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/StorageKeys/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "avatar": {
              "href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            }
          },
          "url": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/ServicePrincipals/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz",
          "descriptor": "aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
        },
        "id": "ed82811a-0890-6f7f-813e-69dd9ebd5ba3",
        "accessLevel": {
          "licensingSource": "account",
          "accountLicenseType": "earlyAdopter",
          "msdnLicenseType": "none",
          "licenseDisplayName": "Early Adopter",
          "status": "pending",
          "statusMessage": "",
          "assignmentSource": "unknown"
        },
        "lastAccessedDate": "0001-01-01T00:00:00",
        "dateCreated": "0001-01-01T00:00:00",
        "projectEntitlements": null,
        "groupAssignments": null
      }
    },
    {
      "servicePrincipalId": "ed82811a-0890-6f7f-813e-69dd9ebd5ba3",
      "isSuccess": true,
      "errors": [],
      "result": null
    },
    {
      "servicePrincipalId": "ed82811a-0890-6f7f-813e-69dd9ebd5ba3",
      "isSuccess": true,
      "errors": [],
      "result": null
    },
    {
      "servicePrincipalId": "ed82811a-0890-6f7f-813e-69dd9ebd5ba3",
      "isSuccess": true,
      "errors": [],
      "result": {
        "servicePrincipal": {
          "subjectKind": "servicePrincipal",
          "applicationId": "d1a24244-f6cc-488b-bca7-42eb10f13c5b",
          "metaType": "application",
          "directoryAlias": "00ed1ce5-4257-4bbd-946e-1b57718e203e",
          "domain": "faab4a73-0db3-4a5e-8e8a-02188f1d3f4b",
          "principalName": "d1a24244-f6cc-488b-bca7-42eb10f13c5b",
          "mailAddress": null,
          "origin": "aad",
          "originId": "00ed1ce5-4257-4bbd-946e-1b57718e203e",
          "displayName": "Service principal",
          "_links": {
            "self": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/ServicePrincipals/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "memberships": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/Memberships/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "membershipState": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/MembershipStates/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "storageKey": {
              "href": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/StorageKeys/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            },
            "avatar": {
              "href": "https://dev.azure.com/fabrikam/_apis/GraphProfile/MemberAvatars/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
            }
          },
          "url": "https://vssps.dev.azure.com/fabrikam/_apis/Graph/ServicePrincipals/aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz",
          "descriptor": "aadsp.ZWQ4MjgxMWEtMDg5MC03ZjdmLTgxM2UtNjlkZDllYmQ1YmEz"
        },
        "id": "ed82811a-0890-6f7f-813e-69dd9ebd5ba3",
        "accessLevel": {
          "licensingSource": "account",
          "accountLicenseType": "earlyAdopter",
          "msdnLicenseType": "none",
          "licenseDisplayName": "Early Adopter",
          "status": "pending",
          "statusMessage": "",
          "assignmentSource": "unknown"
        },
        "lastAccessedDate": "0001-01-01T00:00:00Z",
        "dateCreated": "2023-02-08T12:30:21.5692042Z",
        "projectEntitlements": [],
        "groupAssignments": []
      }
    }
  ]
}

Definitions

Name Description
JsonPatchDocument

The JSON model for JSON Patch Operations

Operation

The patch operation

OperationStatus

The current status of the operation.

ServicePrincipalEntitlementOperationReference
ServicePrincipalEntitlementOperationResult

JsonPatchDocument

The JSON model for JSON Patch Operations

Name Type Description
from

string

The path to copy from for the Move/Copy operation.

op

Operation

The patch operation

path

string

The path for the operation. In the case of an array, a zero based index can be used to specify the position in the array (e.g. /biscuits/0/name). The "-" character can be used instead of an index to insert at the end of the array (e.g. /biscuits/-).

value

object

The value for the operation. This is either a primitive or a JToken.

Operation

The patch operation

Name Type Description
add

string

copy

string

move

string

remove

string

replace

string

test

string

OperationStatus

The current status of the operation.

Name Type Description
cancelled

string

The operation was cancelled by the user.

failed

string

The operation completed with a failure.

inProgress

string

The operation is in progress.

notSet

string

The operation does not have a status set.

queued

string

The operation has been queued.

succeeded

string

The operation completed successfully.

ServicePrincipalEntitlementOperationReference

Name Type Description
completed

boolean

Operation completed with success or failure.

haveResultsSucceeded

boolean

True if all operations were successful.

id

string

Unique identifier for the operation.

pluginId

string

Unique identifier for the plugin.

results

ServicePrincipalEntitlementOperationResult[]

List of results for each operation.

status

OperationStatus

The current status of the operation.

url

string

URL to get the full operation object.

ServicePrincipalEntitlementOperationResult

Name Type Description
errors

object[]

List of error codes paired with their corresponding error messages.

isSuccess

boolean

Success status of the operation.

result

string

Resulting entitlement property. For specific implementations, see also:

servicePrincipalId

string

Identifier of the ServicePrincipal being acted upon.