名前空間: microsoft.graph.cloudLicensing
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
organizationの割り当てコレクションに投稿して、新しいライセンスの割り当てを作成します。
割り当てには、割り当てとユーザーまたはグループとの直接的な関係が常に必要です。
/admin/cloudLicensing/assignmentsにある中央の割り当てコレクションに投稿して割り当てを作成する場合は、両方のリレーションシップを要求本文で確立する必要があります。 割り当ては、割 り当ての割り当て コレクション、ユーザーの 割り当て コレクション、またはグループの 割り当て コレクションに転記することによっても作成できます。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
CloudLicensing.AssignLicenses |
CloudLicensing.AssignLicenses.Organization、User-CloudLicensing.AssignLicenses、User-CloudLicensing.AssignLicenses.Organization、User.ReadWrite.All、Group-CloudLicensing.AssignLicenses、Group-CloudLicensing.AssignLicenses.Organization、Group.ReadWrite.All、Directory.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
CloudLicensing.AssignLicenses.Organization |
User-CloudLicensing.AssignLicenses.Organization、User.ReadWrite.All、Group-CloudLicensing.AssignLicenses.Organization、Group.ReadWrite.All、Directory.ReadWrite.All |
HTTP 要求
POST /admin/cloudLicensing/assignments
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 割り当て オブジェクトの JSON 表現を指定します。
割り当てを作成するときに、次のプロパティを指定できます。
| プロパティ |
型 |
説明 |
| disabledServicePlanIds |
GUID コレクション |
この割り当ての無効なサービス プランの一覧。 空のリストは、すべてのサービスが有効になっていることを示します。 必須です。 |
割り当てを作成するときに、次のリレーションシップを指定できます。
応答
成功した場合、このメソッドは応答コード 201 Created と、応答本文に microsoft.graph.cloudLicensing.assignment オブジェクトを返します。
例
要求
次の例は要求を示しています。
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"
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.CloudLicensing;
var requestBody = new Assignment
{
OdataType = "#microsoft.graph.cloudLicensing.assignment",
DisabledServicePlanIds = new List<Guid?>
{
Guid.Parse("bed136c6-b799-4462-824d-fc045d3a9d25"),
},
AdditionalData = new Dictionary<string, object>
{
{
"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"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.CloudLicensing.Assignments.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelscloudlicensing "github.com/microsoftgraph/msgraph-beta-sdk-go/models/cloudlicensing"
//other-imports
)
requestBody := graphmodelscloudlicensing.NewAssignment()
disabledServicePlanIds := []uuid.UUID {
uuid.MustParse("bed136c6-b799-4462-824d-fc045d3a9d25"),
}
requestBody.SetDisabledServicePlanIds(disabledServicePlanIds)
additionalData := map[string]interface{}{
"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",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignments, err := graphClient.Admin().CloudLicensing().Assignments().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.cloudlicensing.Assignment assignment = new com.microsoft.graph.beta.models.cloudlicensing.Assignment();
assignment.setOdataType("#microsoft.graph.cloudLicensing.assignment");
LinkedList<UUID> disabledServicePlanIds = new LinkedList<UUID>();
disabledServicePlanIds.add(UUID.fromString("bed136c6-b799-4462-824d-fc045d3a9d25"));
assignment.setDisabledServicePlanIds(disabledServicePlanIds);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("allotment@odata.bind", "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi");
additionalData.put("assignedTo@odata.bind", "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b");
assignment.setAdditionalData(additionalData);
com.microsoft.graph.models.cloudlicensing.Assignment result = graphClient.admin().cloudLicensing().assignments().post(assignment);
const options = {
authProvider,
};
const client = Client.init(options);
const assignment = {
'@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'
]
};
await client.api('/admin/cloudLicensing/assignments')
.version('beta')
.post(assignment);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\CloudLicensing\Assignment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Assignment();
$requestBody->setOdataType('#microsoft.graph.cloudLicensing.assignment');
$requestBody->setDisabledServicePlanIds(['bed136c6-b799-4462-824d-fc045d3a9d25', ]);
$additionalData = [
'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',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->admin()->cloudLicensing()->assignments()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.cloud_licensing.assignment import Assignment
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Assignment(
odata_type = "#microsoft.graph.cloudLicensing.assignment",
disabled_service_plan_ids = [
UUID("bed136c6-b799-4462-824d-fc045d3a9d25"),
],
additional_data = {
"allotment@odata_bind" : "https://graph.microsoft.com/beta/admin/cloudLicensing/allotments/rkocgef3dgjhnu3gmu2mqhbdbmwcymnf6fk3k6a7zbui5e7gfpmi",
"assigned_to@odata_bind" : "https://graph.microsoft.com/beta/users/6d645c5f-089f-40d8-b0e7-136fb5c56d5b",
}
)
result = await graph_client.admin.cloud_licensing.assignments.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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"
]
}