| title | Create assignment |
|---|---|
| description | Create a new license assignment by posting to the assignments collection of an organization. |
| author | patrick-starrin |
| ms.date | 07/18/2025 |
| ms.localizationpriority | medium |
| ms.subservice | cloud-licensing |
| doc_type | apiPageType |
Namespace: microsoft.graph.cloudLicensing
[!INCLUDE beta-disclaimer]
Create a new license assignment by posting to the assignments collection of an organization.
An assignment must always have a direct relationship to an allotment and to a user or group. If an assignment is created by posting to the central assignments collection located at /admin/cloudLicensing/assignments, both of those relationships must be established in the request body. Assignments can also be created by posting to the assignments collection of an allotment, the assignments collection of a user or the assignments collection of a group.
[!INCLUDE national-cloud-support]
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.
[!INCLUDE permissions-table]
POST /admin/cloudLicensing/assignments| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
In the request body, supply a JSON representation of the assignment object.
You can specify the following properties when you create an assignment.
| Property | Type | Description |
|---|---|---|
| disabledServicePlanIds | GUID collection | The list of disabled service plans for this assignment. An empty list indicates that all services are enabled. Required. |
You can specify the following relationships when you create an assignment.
| Relationship | Type | Description |
|---|---|---|
| allotment | microsoft.graph.cloudLicensing.allotment | The allotment from which licenses are assigned. Required. |
| assignedTo | directoryObject | The user or group to which licenses are assigned. Required. |
If successful, this method returns a 201 Created response code and a microsoft.graph.cloudLicensing.assignment object in the response body.
The following example shows a request.
POST https://graph.microsoft.com/beta/admin/cloudLicensing/assignments
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.cloudLicensing.assignment",
"allotment@odata.bind": "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi",
"assignedTo@odata.bind": "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b",
"disabledServicePlanIds": [
"bed136c6-b799-4462-824d-fc045d3a9d25"
]
}[!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]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.cloudLicensing.assignment",
"id": "405ee855-dd74-f695-8d7e-be35a6788fe8",
"disabledServicePlanIds": [
"bed136c6-b799-4462-824d-fc045d3a9d25"
]
}