unifiedRoleAssignments を一覧表示する
[アーティクル]
05/05/2022
3 人の共同作成者
この記事の内容
名前空間: microsoft.graph
RBAC プロバイダーの unifiedRoleAssignment オブジェクトの一覧を取得します。
現在、次の RBAC プロバイダーがサポートされています。
ディレクトリ (Azure AD)
エンタイトルメント管理 (Azure AD)
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可 」を参照してください。
ディレクトリ (Azure AD) プロバイダーの場合
アクセス許可の種類
アクセス許可 (特権の小さいものから大きいものへ)
委任 (職場または学校のアカウント)
RoleManagement.Read.Directory, Directory.Read.All, RoleManagement.ReadWrite.Directory, Directory.ReadWrite.All
委任 (個人用 Microsoft アカウント)
サポートされていません。
アプリケーション
RoleManagement.Read.Directory, Directory.Read.All, RoleManagement.ReadWrite.Directory, Directory.ReadWrite.All
エンタイトルメント管理プロバイダーの場合
アクセス許可の種類
アクセス許可 (特権の小さいものから大きいものへ)
委任 (職場または学校のアカウント)
EntitlementManagement.Read.All、EntitlementManagement.ReadWrite.All
委任 (個人用 Microsoft アカウント)
サポートされていません。
アプリケーション
EntitlementManagement.Read.All、EntitlementManagement.ReadWrite.All
HTTP 要求
ディレクトリ プロバイダーのロールの割り当てを一覧表示するには:
GET /roleManagement/directory/roleAssignments?$filter=principalId eq '{principal id}'
GET /roleManagement/directory/roleAssignments?$filter=roleDefinitionId eq '{roleDefinition id}'
エンタイトルメント管理プロバイダーのロールの割り当てを一覧表示するには:
GET /roleManagement/entitlementManagement/roleAssignments?$filter=principalId eq '{principal id}'
GET /roleManagement/entitlementManagement/roleAssignments?$filter=roleDefinitionId eq '{roleDefinition id}'
GET /roleManagement/entitlementManagement/roleAssignments?$filter=appScopeId eq '/AccessPackageCatalog/{catalog id}'
クエリ パラメーター
この操作では、サポートされている RBAC プロバイダーの $filter ロールの割り当てを照会するためにクエリ パラメーターが必要です。
ディレクトリ プロバイダーの場合は、 roleDefinitionId プロパティまたは principalId プロパティでフィルター処理する必要があります。 roleDefinitionId プロパティには、ロール オブジェクト ID または templateId プロパティの値を指定できます。
エンタイトルメント管理プロバイダーの場合は、 roleDefinitionId 、 principalId 、 appScopeId のいずれかのプロパティでフィルター処理する必要があります。
一般的な情報については、「OData クエリ パラメーター 」を参照してください。
名前
説明
Authorization
ベアラー {トークン}
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このメソッドは 200 OK 応答コードと応答本文内の unifiedRoleAssignment オブジェクトのコレクションを返します。
例
例 1: roleDefinitionId のフィルターを使用して要求し、プリンシパル オブジェクトを展開する
要求
要求の例を次に示します。
GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?$filter=roleDefinitionId eq '62e90394-69f5-4237-9190-012177145e10'&$expand=principal
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var roleAssignments = await graphClient.RoleManagement.Directory.RoleAssignments
.Request()
.Filter("roleDefinitionId eq '62e90394-69f5-4237-9190-012177145e10'")
.Expand("principal")
.GetAsync();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
const options = {
authProvider,
};
const client = Client.init(options);
let roleAssignments = await client.api('/roleManagement/directory/roleAssignments')
.filter('roleDefinitionId eq \'62e90394-69f5-4237-9190-012177145e10\'')
.expand('principal')
.get();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/roleManagement/directory/roleAssignments?$filter=roleDefinitionId%20eq%20'62e90394-69f5-4237-9190-012177145e10'&$expand=principal"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphUnifiedRoleAssignment *unifiedRoleAssignment = [[MSGraphUnifiedRoleAssignment alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
UnifiedRoleAssignmentCollectionPage roleAssignments = graphClient.roleManagement().directory().roleAssignments()
.buildRequest()
.filter("roleDefinitionId eq '62e90394-69f5-4237-9190-012177145e10'")
.expand("principal")
.get();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestParameters := &msgraphsdk.RoleAssignmentsRequestBuilderGetQueryParameters{
Filter: "roleDefinitionId%20eq%20'62e90394-69f5-4237-9190-012177145e10'",
Expand: "principal",
}
options := &msgraphsdk.RoleAssignmentsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
result, err := graphClient.RoleManagement().Directory().RoleAssignments().GetWithRequestConfigurationAndResponseHandler(options, nil)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
Import-Module Microsoft.Graph.DeviceManagement.Enrolment
Get-MgRoleManagementDirectoryRoleAssignment -Filter "roleDefinitionId eq '62e90394-69f5-4237-9190-012177145e10'" -ExpandProperty "principal"
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
応答
応答の例を次に示します。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#roleManagement/directory/roleAssignments(principal())",
"value": [
{
"id": "lAPpYvVpN0KRkAEhdxReEMmO4KwRqtpKkUWt3wOYIz4-1",
"principalId": "ace08ec9-aa11-4ada-9145-addf0398233e",
"resourceScope": "/",
"directoryScopeId": "/",
"roleDefinitionId": "62e90394-69f5-4237-9190-012177145e10",
"principal": {
"@odata.type": "#microsoft.graph.user",
"id": "ace08ec9-aa11-4ada-9145-addf0398233e",
"accountEnabled": true,
"displayName": "Joey Cruz",
"imAddresses": [
"joeyc@contoso.com"
],
"mail": "joeyc@contoso.com",
"mailNickname": "joeyc",
"userType": "Member",
}
},
{
"id": "lAPpYvVpN0KRkAEhdxReEC6Xh29-LklLmYDrOIi9z-E-1",
"principalId": "6f87972e-2e7e-4b49-9980-eb3888bdcfe1",
"resourceScope": "/",
"directoryScopeId": "/",
"roleDefinitionId": "62e90394-69f5-4237-9190-012177145e10",
"principal": {
"@odata.type": "#microsoft.graph.user",
"id": "6f87972e-2e7e-4b49-9980-eb3888bdcfe1",
"accountEnabled": true,
"displayName": "Kalyan Krishna",
"imAddresses": [],
"userType": "Guest",
}
},
{
"id": "lAPpYvVpN0KRkAEhdxReEMgc_BA2rIZBuZsM-BSqLdU-1",
"principalId": "10fc1cc8-ac36-4186-b99b-0cf814aa2dd5",
"resourceScope": "/",
"directoryScopeId": "/",
"roleDefinitionId": "62e90394-69f5-4237-9190-012177145e10",
"principal": {
"@odata.type": "#microsoft.graph.user",
"id": "10fc1cc8-ac36-4186-b99b-0cf814aa2dd5",
"accountEnabled": true,
"displayName": "Markie Downing",
"imAddresses": [],
"userType": "Guest",
}
}
]
}
例 2: principalId のフィルターを使用した要求
要求
要求の例を次に示します。
GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?$filter = principalId eq 'f1847572-48aa-47aa-96a3-2ec61904f41f'
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var roleAssignments = await graphClient.RoleManagement.Directory.RoleAssignments
.Request()
.Filter(" principalId eq 'f1847572-48aa-47aa-96a3-2ec61904f41f'")
.GetAsync();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
const options = {
authProvider,
};
const client = Client.init(options);
let roleAssignments = await client.api('/roleManagement/directory/roleAssignments')
.filter(' principalId eq \'f1847572-48aa-47aa-96a3-2ec61904f41f\'')
.get();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/roleManagement/directory/roleAssignments?$filter%20=%20principalId%20eq%20'f1847572-48aa-47aa-96a3-2ec61904f41f'"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphUnifiedRoleAssignment *unifiedRoleAssignment = [[MSGraphUnifiedRoleAssignment alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
UnifiedRoleAssignmentCollectionPage roleAssignments = graphClient.roleManagement().directory().roleAssignments()
.buildRequest()
.filter(" principalId eq 'f1847572-48aa-47aa-96a3-2ec61904f41f'")
.get();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestParameters := &msgraphsdk.RoleAssignmentsRequestBuilderGetQueryParameters{
Filter%20: "%20principalId%20eq%20'f1847572-48aa-47aa-96a3-2ec61904f41f'",
}
options := &msgraphsdk.RoleAssignmentsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
result, err := graphClient.RoleManagement().Directory().RoleAssignments().GetWithRequestConfigurationAndResponseHandler(options, nil)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
Import-Module Microsoft.Graph.DeviceManagement.Enrolment
Get-MgRoleManagementDirectoryRoleAssignment -Filter " principalId eq 'f1847572-48aa-47aa-96a3-2ec61904f41f'"
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
応答
応答の例を次に示します。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#roleManagement/directory/roleAssignments",
"value": [
{
"id": "lAPpYvVpN0KRkAEhdxReEHJ1hPGqSKpHlqMuxhkE9B8-1",
"principalId": "f1847572-48aa-47aa-96a3-2ec61904f41f",
"resourceScope": "/",
"directoryScopeId": "/",
"roleDefinitionId": "62e90394-69f5-4237-9190-012177145e10"
},
{
"id": "LJnv8vs6uUa3z6Em7nTEUXJ1hPGqSKpHlqMuxhkE9B8-1",
"principalId": "f1847572-48aa-47aa-96a3-2ec61904f41f",
"resourceScope": "/",
"directoryScopeId": "/",
"roleDefinitionId": "f2ef992c-3afb-46b9-b7cf-a126ee74c451"
}
]
}
例 3: アクセス パッケージ カタログのロールの割り当てに$filterを使用して要求し、プリンシパル オブジェクトを展開する
要求
要求の例を次に示します。
GET https://graph.microsoft.com/v1.0/roleManagement/entitlementManagement/roleAssignments?$filter=appScopeId eq '/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc'&$expand=principal
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var roleAssignments = await graphClient.RoleManagement.EntitlementManagement.RoleAssignments
.Request()
.Filter("appScopeId eq '/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc'")
.Expand("principal")
.GetAsync();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
const options = {
authProvider,
};
const client = Client.init(options);
let roleAssignments = await client.api('/roleManagement/entitlementManagement/roleAssignments')
.filter('appScopeId eq \'/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc\'')
.expand('principal')
.get();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/roleManagement/entitlementManagement/roleAssignments?$filter=appScopeId%20eq%20'/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc'&$expand=principal"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphUnifiedRoleAssignment *unifiedRoleAssignment = [[MSGraphUnifiedRoleAssignment alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
UnifiedRoleAssignmentCollectionPage roleAssignments = graphClient.roleManagement().entitlementManagement().roleAssignments()
.buildRequest()
.filter("appScopeId eq '/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc'")
.expand("principal")
.get();
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestParameters := &msgraphsdk.RoleAssignmentsRequestBuilderGetQueryParameters{
Filter: "appScopeId%20eq%20'/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc'",
Expand: "principal",
}
options := &msgraphsdk.RoleAssignmentsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
result, err := graphClient.RoleManagement().EntitlementManagement().RoleAssignments().GetWithRequestConfigurationAndResponseHandler(options, nil)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
Import-Module Microsoft.Graph.DeviceManagement.Enrolment
Get-MgRoleManagementEntitlementManagementRoleAssignment -Filter "appScopeId eq '/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc'" -ExpandProperty "principal"
SDK をプロジェクトに追加し、authProvider インスタンスを作成する 方法の詳細については、SDK のドキュメントを参照してください 。
応答
応答の例を次に示します。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "900633fe-2508-4b13-a561-a15e320ad35f",
"principalId": "39228473-522e-4533-88cc-a9553180cb99",
"roleDefinitionId": "ae79f266-94d4-4dab-b730-feca7e132178",
"appScopeId": "/AccessPackageCatalog/4cee616b-fdf9-4890-9d10-955e0ccb12bc",
"principal": {
"@odata.type": "#microsoft.graph.user",
"id": "39228473-522e-4533-88cc-a9553180cb99"
}
}
]
}