名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
注:
Microsoft では、この API の代わりに統合 RBAC API を使用することをお勧めします。 統合 RBAC API は、より多くの機能と柔軟性を提供します。 詳細については、「 UnifiedRoleDefinition を取得する」を参照してください。
directoryrole オブジェクトのプロパティを取得します。
この API では、 directoryRole のオブジェクト ID とテンプレート ID の両方を使用できます。 組み込みロールのテンプレート ID は不変であり、Microsoft Entra 管理センターのロールの説明で確認できます。 詳細については、「 ロール テンプレート ID」を参照してください。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
RoleManagement.Read.Directory |
Directory.Read.All、Directory.ReadWrite.All、RoleManagement.ReadWrite.Directory |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
| アプリケーション |
RoleManagement.Read.Directory |
Directory.Read.All、Directory.ReadWrite.All、RoleManagement.ReadWrite.Directory |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーに、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。 この操作では、次の最小特権ロールがサポートされています。
- ユーザー管理者
- ヘルプデスク管理者
- サービス サポート管理者
- 課金管理者
- User
- メールボックスの管理者
- ディレクトリ リーダー
- ディレクトリ製作者
- アプリケーション管理者
- セキュリティ閲覧者
- セキュリティ管理者
- 特権ロール管理者
- クラウド アプリケーション管理者
- カスタマー ロックボックス アクセス承認者
- Dynamics 365管理者
- Power BI 管理者
- Azure Information Protection 管理者
- Desktop Analytics管理者
- ライセンス管理者
- Microsoft マネージド デスクトップ管理者
- 認証管理者
- 特権認証管理者
- Teams 通信管理者
- Teams 通信サポート エンジニア
- Teams 通信サポート スペシャリスト
- Teams 管理者
- Insights 管理者
- コンプライアンス データ管理者
- セキュリティ オペレーター
- Kaizala 管理者
- グローバル閲覧者
- ボリューム ライセンス ビジネス センター ユーザー
- ボリューム ライセンス Service Center ユーザー
- モダン コマース管理者
- ビジネス向け Microsoft Store ユーザー
- ディレクトリレビュー担当者
HTTP 要求
ディレクトリ ロールは、 その ID または roleTemplateId を使用してアドレス指定できます。
GET /directoryRoles/{role-id}
GET /directoryRoles(roleTemplateId='{roleTemplateId}')
オプションのクエリ パラメーター
このメソッドは、応答のカスタマイズに役立つ $selectOData クエリ パラメーター をサポートします。
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このメソッドは 200 OK 応答コードと、応答本文で directoryRole オブジェクトを返します。
例
例 1: ロール ID を使用してディレクトリ ロールの定義を取得する
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/beta/directoryRoles/fe8f10bf-c9c2-47eb-95cb-c26cc85f1830
// 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.DirectoryRoles["{directoryRole-id}"].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
directoryRoles, err := graphClient.DirectoryRoles().ByDirectoryRoleId("directoryRole-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DirectoryRole result = graphClient.directoryRoles().byDirectoryRoleId("{directoryRole-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let directoryRole = await client.api('/directoryRoles/fe8f10bf-c9c2-47eb-95cb-c26cc85f1830')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->directoryRoles()->byDirectoryRoleId('directoryRole-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDirectoryRole -DirectoryRoleId $directoryRoleId
# 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.directory_roles.by_directory_role_id('directoryRole-id').get()
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#directoryRoles/$entity",
"id": "fe8f10bf-c9c2-47eb-95cb-c26cc85f1830",
"deletedDateTime": null,
"description": "Can read basic directory information. Commonly used to grant directory read access to applications and guests.",
"displayName": "Directory Readers",
"roleTemplateId": "88d8e3e3-8f55-4a1e-953a-9b9898b8876b"
}
例 2: roleTemplateId を使用してディレクトリ ロールの定義を取得する
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/beta/directoryRoles(roleTemplateId='88d8e3e3-8f55-4a1e-953a-9b9898b8876b')
// 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.DirectoryRolesWithRoleTemplateId("{roleTemplateId}").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
roleTemplateId := "{roleTemplateId}"
directoryRoles, err := graphClient.DirectoryRolesWithRoleTemplateId(&roleTemplateId).Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DirectoryRole result = graphClient.directoryRolesWithRoleTemplateId("{roleTemplateId}").get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->directoryRolesWithRoleTemplateId('{roleTemplateId}', )->get()->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
Get-MgBetaDirectoryRoleByRoleTemplateId
# 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.directory_roles_with_role_template_id("{roleTemplateId}").get()
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#directoryRoles/$entity",
"id": "fe8f10bf-c9c2-47eb-95cb-c26cc85f1830",
"deletedDateTime": null,
"description": "Can read basic directory information. Commonly used to grant directory read access to applications and guests.",
"displayName": "Directory Readers",
"roleTemplateId": "88d8e3e3-8f55-4a1e-953a-9b9898b8876b"
}