命名空间: microsoft.graph.cloudLicensing
重要
Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
获取组织内许可证 分配 对象的列表。
API 可用性
此 API 可用于以下国家级云部署。
| 全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
| ✅ |
✅ |
✅ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
获取管理员 分配 列表的权限:
GET /admin/cloudLicensing/assignments
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
CloudLicensing.Read |
CloudLicensing.Read.All、Directory.Read.All、Directory.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
CloudLicensing.Read.All |
Directory.Read.All、Directory.ReadWrite.All |
获取用户 分配 列表的权限:
GET /users/{userId}/cloudLicensing/assignments
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
CloudLicensing.Read |
CloudLicensing.Read.All、User-CloudLicensing.Read.All、User.Read.All、User.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
CloudLicensing.Read.All |
User-CloudLicensing.Read.All、User.Read.All、User.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
获取组 作业 列表的权限:
GET /groups/{groupId}/cloudLicensing/assignments
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
CloudLicensing.Read |
CloudLicensing.Read.All、Group-CloudLicensing.Read.All、Group.Read.All、Group.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
CloudLicensing.Read.All |
Group-CloudLicensing.Read.All、Group.Read.All、Group.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
HTTP 请求
GET /admin/cloudLicensing/assignments
GET /users/{userId}/cloudLicensing/assignments
GET /groups/{groupId}/cloudLicensing/assignments
可选的查询参数
此方法支持 $select、 $top、 $expand和 $filter OData 查询参数,以帮助自定义响应。 若要了解一般信息,请参阅 OData 查询参数。
| 名称 |
说明 |
| Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法将在响应正文中返回响应 200 OK 代码和 microsoft.graph.cloudLicensing.assignment 对象的集合。
示例
示例 1:获取作业
下面的示例演示如何获取 分配 对象的列表。
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/admin/cloudLicensing/assignments
// Code snippets are only available for the latest version. Current version is 5.x
// 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.GetAsync();
// 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"
//other-imports
)
// 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().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.cloudlicensing.AssignmentCollectionResponse result = graphClient.admin().cloudLicensing().assignments().get();
const options = {
authProvider,
};
const client = Client.init(options);
let assignments = await client.api('/admin/cloudLicensing/assignments')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->admin()->cloudLicensing()->assignments()->get()->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.admin.cloud_licensing.assignments.get()
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
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"
]
}
]
}
示例 2:获取作业及其分配
下面的示例演示如何使用查询参数获取 分配 对象及其分配 expand 的列表。
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/admin/cloudLicensing/assignments?$expand=assignedTo,allotment
// Code snippets are only available for the latest version. Current version is 5.x
// 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.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "assignedTo","allotment" };
});
// 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"
graphadmin "github.com/microsoftgraph/msgraph-beta-sdk-go/admin"
//other-imports
)
requestParameters := &graphadmin.CloudLicensingAssignmentsRequestBuilderGetQueryParameters{
Expand: [] string {"assignedTo","allotment"},
}
configuration := &graphadmin.CloudLicensingAssignmentsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// 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().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.cloudlicensing.AssignmentCollectionResponse result = graphClient.admin().cloudLicensing().assignments().get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"assignedTo", "allotment"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let assignments = await client.api('/admin/cloudLicensing/assignments')
.version('beta')
.expand('assignedTo,allotment')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Admin\CloudLicensing\Assignments\AssignmentsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new AssignmentsRequestBuilderGetRequestConfiguration();
$queryParameters = AssignmentsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["assignedTo","allotment"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->admin()->cloudLicensing()->assignments()->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.admin.cloud_licensing.assignments.assignments_request_builder import AssignmentsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = AssignmentsRequestBuilder.AssignmentsRequestBuilderGetQueryParameters(
expand = ["assignedTo","allotment"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.admin.cloud_licensing.assignments.get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
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"
},
"allotment": {
"@odata.type": "#microsoft.graph.cloudLicensing.allotment",
"id": "fde42873-30b6-436b-b361-21af5a6b84ae",
"allottedUnits": 100,
"assignableTo": "user,group",
"consumedUnits": 84,
"services": [
{
"@odata.type": "#microsoft.graph.cloudLicensing.service",
"assignableTo": "user,group",
"planId": "f4f2f6de-6830-442b-a433-e92249faebe2",
"planName": "TeamsEss"
}
],
"skuId": "f245ecc8-75af-4f8e-b61f-27d8114de5f3",
"skuPartNumber": "Teams_Ess"
}
}
]
}
示例 3:获取按 skuId 筛选的作业
下面的示例演示如何获取按 skuId 属性筛选的分配对象列表。
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/admin/cloudLicensing/assignments?$expand=allotment($filter=skuId in (639dec6b-bb19-468b-871c-c5c441c4b0cb, a403ebcc-fae0-4ca2-8c8c-7a907fd6c235))
// Code snippets are only available for the latest version. Current version is 5.x
// 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.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "allotment($filter=skuId in (639dec6b-bb19-468b-871c-c5c441c4b0cb, a403ebcc-fae0-4ca2-8c8c-7a907fd6c235)",")" };
});
// 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"
graphadmin "github.com/microsoftgraph/msgraph-beta-sdk-go/admin"
//other-imports
)
requestParameters := &graphadmin.CloudLicensingAssignmentsRequestBuilderGetQueryParameters{
Expand: [] string {"allotment($filter=skuId in (639dec6b-bb19-468b-871c-c5c441c4b0cb, a403ebcc-fae0-4ca2-8c8c-7a907fd6c235)",")"},
}
configuration := &graphadmin.CloudLicensingAssignmentsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// 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().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.cloudlicensing.AssignmentCollectionResponse result = graphClient.admin().cloudLicensing().assignments().get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"allotment($filter=skuId in (639dec6b-bb19-468b-871c-c5c441c4b0cb, a403ebcc-fae0-4ca2-8c8c-7a907fd6c235)", ")"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let assignments = await client.api('/admin/cloudLicensing/assignments')
.version('beta')
.expand('allotment($filter=skuId in (639dec6b-bb19-468b-871c-c5c441c4b0cb, a403ebcc-fae0-4ca2-8c8c-7a907fd6c235))')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Admin\CloudLicensing\Assignments\AssignmentsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new AssignmentsRequestBuilderGetRequestConfiguration();
$queryParameters = AssignmentsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["allotment(\$filter=skuId in (639dec6b-bb19-468b-871c-c5c441c4b0cb, a403ebcc-fae0-4ca2-8c8c-7a907fd6c235)",")"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->admin()->cloudLicensing()->assignments()->get($requestConfiguration)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.admin.cloud_licensing.assignments.assignments_request_builder import AssignmentsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = AssignmentsRequestBuilder.AssignmentsRequestBuilderGetQueryParameters(
expand = ["allotment($filter=skuId in (639dec6b-bb19-468b-871c-c5c441c4b0cb, a403ebcc-fae0-4ca2-8c8c-7a907fd6c235)",")"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.admin.cloud_licensing.assignments.get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
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"
],
"allotment": {
"@odata.type": "#microsoft.graph.cloudLicensing.allotment",
"id": "551f1755-0184-9e51-0bc7-f32bae5a1afb",
"allottedUnits": 250,
"assignableTo": "user,group",
"consumedUnits": 224,
"services": [
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "user,group",
"planId": "9aaf7827-d63c-4b61-89c3-182f06f82e5c",
"planName": "EXCHANGE_S_STANDARD"
},
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "none",
"planId": "6f23d6a9-adbf-481c-8538-b4c095654487",
"planName": "M365_LIGHTHOUSE_CUSTOMER_PLAN1"
},
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "none",
"planId": "882e1d05-acd1-4ccb-8708-6ee03664b117",
"planName": "INTUNE_O365"
},
{
"@odata.type": "microsoft.graph.cloudLicensing.service",
"assignableTo": "user,group",
"planId": "5e62787c-c316-451f-b873-1d05acd4d12c",
"planName": "BPOS_S_TODO_1"
}
],
"skuId": "a403ebcc-fae0-4ca2-8c8c-7a907fd6c235",
"skuPartNumber": "EXCHANGESTANDARD"
}
}
]
}