Skip to content

Latest commit

 

History

History
241 lines (185 loc) · 8.25 KB

File metadata and controls

241 lines (185 loc) · 8.25 KB
title Get assignment
description Read the properties and relationships of an assignment object.
author patrick-starrin
ms.date 07/18/2025
ms.localizationpriority medium
ms.subservice cloud-licensing
doc_type apiPageType

Get assignment

Namespace: microsoft.graph.cloudLicensing

[!INCLUDE beta-disclaimer]

Read the properties and relationships of an assignment object.

[!INCLUDE national-cloud-support]

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permissions to get an assignment for an admin:

GET /admin/cloudLicensing/assignments/{assignmentId}
GET /admin/cloudLicensing/allotments/{allotmentId}/assignments/{assignmentId}

[!INCLUDE permissions-table]

Permissions to get an assignment for a user:

GET /me/cloudLicensing/assignments/{assignmentId}
GET /users/{userId}/cloudLicensing/assignments/{assignmentId}

[!INCLUDE permissions-table]

Permissions to get an assignment for a group:

GET /groups/{groupId}/cloudLicensing/assignments/{assignmentId}

[!INCLUDE permissions-table]

HTTP request

To get an assignment for the signed-in user using delegated (/me) permissions:

GET /me/cloudLicensing/assignments/{assignmentId}

To get an assignment using either delegated or application permissions:

GET /admin/cloudLicensing/assignments/{assignmentId}
GET /admin/cloudLicensing/allotments/{allotmentId}/assignments/{assignmentId}
GET /groups/{groupId}/cloudLicensing/assignments/{assignmentId}
GET /users/{userId}/cloudLicensing/assignments/{assignmentId}

Optional query parameters

This method supports the $select and $expand OData query parameters to help customize the response. For general information, see OData query parameters.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a microsoft.graph.cloudLicensing.assignment object in the response body.

Examples

Example 1: Get an assignment

The following example shows how to get an assignment object.

Request

The following example shows a request.

GET https://graph.microsoft.com/beta/me/cloudLicensing/assignments/405ee855-dd74-f695-8d7e-be35a6788fe8

[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]

[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]

[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]

[!INCLUDE snippet-not-available] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-Type: application/json

{
  "value": {
    "@odata.type": "#microsoft.graph.cloudLicensing.assignment",
    "disabledServicePlanIds": [
      "9aaf7827-d63c-4b61-89c3-182f06f82e5c"
    ],
    "id": "405ee855-dd74-f695-8d7e-be35a6788fe8"
  }
}

Example 2: Get an assignment and its assignee

The following example shows how to get an assignment object and its assignee by using the $expand query parameter.

Request

The following example shows a request.

GET https://graph.microsoft.com/beta/admin/cloudLicensing/assignments/405ee855-dd74-f695-8d7e-be35a6788fe8?$expand=assignedTo

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-Type: application/json

{
  "value": {
    "@odata.type": "#microsoft.graph.cloudLicensing.assignment",
    "id": "405ee855-dd74-f695-8d7e-be35a6788fe8",
    "disabledServicePlanIds": [
      "5e62787c-c316-451f-b873-1d05acd4d12c"
    ],
    "assignedTo": {
      "@odata.type": "#microsoft.graph.user",
      "id": "a6c034b8-621b-dee3-6abb-52cbce801fe9",
      "displayName": "Steve Fred",
      "userPrincipalName": "stevefred@contoso.com"
    }
  }
}