名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
特定のデバイスの usageRight オブジェクトの一覧を取得します。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
❌ |
❌ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
Device.Read.All |
Directory.Read.All、Directory.ReadWrite.All |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
Device.Read.All |
Device.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーに、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。 この操作では、次の最小特権ロールがサポートされています。
- ディレクトリ リーダー
- グローバル閲覧者
- Intune管理者
- Windows 365 管理者
HTTP 要求
ID またはdeviceId を使用してデバイスをアドレス指定できます。
GET /devices/{objectId}/usageRights
GET /devices(deviceId='{deviceId}')/usageRights
オプションのクエリ パラメーター
この API では、 $filter
OData クエリ パラメーターがサポートされています。 次のパターンの $filter
がサポートされています。
- $filter = 状態 eq 'value'
- $filter = serviceIdentifier eq 'value'
- $filter = 状態 eq 'value' と serviceIdentifier eq 'value'
- $filter = 状態 ('value1', 'value2')
- $filter = serviceIdentifier in ('value1', 'value2')
- $filter = ('value1','value2') の状態と ('value1', 'value2') の serviceIdentifier
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
odata.maxpagesize |
最大結果ページ サイズの範囲を設定します。 省略可能。 |
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このメソッドは 200 OK
応答コードと、応答本文の usageRight オブジェクトのコレクションを返します。
さらに、応答にさらにページがある場合は、 @odata.nextLink が返されます。
例
例 1: デバイスのすべての使用権限を取得する
要求
GET https://graph.microsoft.com/beta/devices/{objectId}/usageRights
// 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.Devices["{device-id}"].UsageRights.GetAsync();
mgc-beta devices usage-rights list --device-id {device-id}
// 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
usageRights, err := graphClient.Devices().ByDeviceId("device-id").UsageRights().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UsageRightCollectionResponse result = graphClient.devices().byDeviceId("{device-id}").usageRights().get();
const options = {
authProvider,
};
const client = Client.init(options);
let usageRights = await client.api('/devices/{objectId}/usageRights')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->devices()->byDeviceId('device-id')->usageRights()->get()->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDeviceUsageRights -DeviceId $deviceId
# 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.devices.by_device_id('device-id').usage_rights.get()
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#devices('fead5c35-ebc5-47c4-a909-c43b4faf2160')/usageRights",
"@odata.nextLink": "https://graph.microsoft.com/beta/devices/fead5c35-ebc5-47c4-a909-c43b4faf2160/usageRights?$skiptoken=W4diD29cGKX1bX",
"value": [
{
"id": "99f828b9-09f2-445d-a758-b6727316dbe1",
"catalogId": "CFQ7TTC0KCRG:0001",
"serviceIdentifier": "mscrm.f6d23ec7-255c-4bd8-8c99-dc041d5cb8b3.517f7ddd-df45-4f1c-83ec-a081a047f546",
"state": "active"
}
]
}
例 2: 特定のサービス識別子と状態を持つデバイスの使用権限を取得する
要求
GET https://graph.microsoft.com/beta/devices/{objectId}/usageRights?$filter=state in ('active', 'suspended') and serviceIdentifier in ('ABCD')
// 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.Devices["{device-id}"].UsageRights.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')";
});
mgc-beta devices usage-rights list --device-id {device-id} --filter "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')"
// 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"
graphdevices "github.com/microsoftgraph/msgraph-beta-sdk-go/devices"
//other-imports
)
requestFilter := "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')"
requestParameters := &graphdevices.ItemUsageRightsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphdevices.ItemUsageRightsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
usageRights, err := graphClient.Devices().ByDeviceId("device-id").UsageRights().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UsageRightCollectionResponse result = graphClient.devices().byDeviceId("{device-id}").usageRights().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')";
});
const options = {
authProvider,
};
const client = Client.init(options);
let usageRights = await client.api('/devices/{objectId}/usageRights')
.version('beta')
.filter('state in (\'active\', \'suspended\') and serviceIdentifier in (\'ABCD\')')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Devices\Item\UsageRights\UsageRightsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new UsageRightsRequestBuilderGetRequestConfiguration();
$queryParameters = UsageRightsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->devices()->byDeviceId('device-id')->usageRights()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDeviceUsageRights -DeviceId $deviceId -Filter "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.devices.item.usage_rights.usage_rights_request_builder import UsageRightsRequestBuilder
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 = UsageRightsRequestBuilder.UsageRightsRequestBuilderGetQueryParameters(
filter = "state in ('active', 'suspended') and serviceIdentifier in ('ABCD')",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.devices.by_device_id('device-id').usage_rights.get(request_configuration = request_configuration)
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#devices('fead5c35-ebc5-47c4-a909-c43b4faf2160')/usageRights",
"value": [
{
"id": "9905e6b1-9040-4926-b028-fdb748c359d6",
"catalogId": "CFQ7TTC0KCRG:0001",
"serviceIdentifier": "ABCD",
"state": "active"
}
]
}