名前空間: microsoft.graph
PIM で、 unifiedRoleAssignmentScheduleRequest オブジェクトを介して次の操作を実行します。
- 有効期限の有無にかかわらず、プリンシパルのアクティブロールと永続的なロールの割り当てを要求します。
- プリンシパルの対象となるロールの割り当てをアクティブ化、非アクティブ化、拡張、または更新します。
この API を呼び出して割り当てを更新、更新、および拡張するには、多要素認証 (MFA) を適用し、MFA に対してチャレンジされたセッションでクエリを実行する必要があります。
「ユーザーごとのMicrosoft Entra多要素認証を有効にしてサインイン イベントをセキュリティで保護する」を参照してください。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
RoleAssignmentSchedule.ReadWrite.Directory |
RoleAssignmentSchedule.Remove.Directory、RoleEligibilitySchedule.Remove.Directory、RoleManagement.ReadWrite.Directory |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
RoleAssignmentSchedule.ReadWrite.Directory |
RoleManagement.ReadWrite.Directory、RoleAssignmentSchedule.Remove.Directory、RoleEligibilitySchedule.Remove.Directory |
重要
職場または学校アカウントを使用した委任されたシナリオでは、サインインしているユーザーに、サポートされているMicrosoft Entraロールまたはサポートされているロールのアクセス許可を持つカスタム ロールを割り当てる必要があります。 この操作では、次の最小特権ロールがサポートされています。
- 読み取り操作の場合: グローバル 閲覧者、セキュリティ オペレーター、セキュリティ閲覧者、セキュリティ管理者、または特権ロール管理者
- 書き込み操作の場合: 特権ロール管理者
HTTP 要求
POST /roleManagement/directory/roleAssignmentScheduleRequests
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 unifiedRoleAssignmentScheduleRequest オブジェクトの JSON 表現を指定します。
unifiedRoleAssignmentScheduleRequest を作成するときに、次のプロパティを指定できます。
プロパティ |
型 |
説明 |
action |
unifiedRoleScheduleRequestActions |
ロールの割り当て要求に対する操作の種類を表します。 使用可能な値: adminAssign 、adminUpdate 、adminRemove 、selfActivate 、selfDeactivate 、adminExtend 、adminRenew 、selfExtend 、selfRenew 、unknownFutureValue 。
-
adminAssign : 管理者がユーザーまたはグループにロールを割り当てる場合。 -
adminRemove : 管理者がロールからユーザーまたはグループを削除する場合。 -
adminUpdate : 管理者が既存のロールの割り当てを変更する場合。 -
adminExtend : 管理者が期限切れの割り当てを延長する場合。 -
adminRenew : 管理者が期限切れの割り当てを更新する場合。 -
selfActivate : ユーザーが自分の割り当てをアクティブ化します。 -
selfDeactivate : ユーザーがアクティブな割り当てを非アクティブ化する。 -
selfExtend : ユーザーが期限切れの割り当ての延長を要求する。 -
selfRenew : ユーザーが期限切れの割り当ての更新を要求する。
|
customData |
String |
要求のカスタム データを定義するフリー テキスト フィールド。 省略可能。 |
principalId |
String |
割り当てが付与されているプリンシパルの識別子。 必須です。 |
roleDefinitionId |
String |
割り当てられている unifiedRoleDefinition オブジェクトの識別子。 必須です。 |
directoryScopeId |
String |
割り当てのスコープを表すディレクトリ オブジェクトの識別子。 割り当てのスコープによって、プリンシパルにアクセス権が付与されているリソースのセットが決まります。 ディレクトリ スコープは、複数のアプリケーションによって認識されるディレクトリに格納されている共有スコープです。 テナント全体のスコープには / を使用します。
appScopeId を使用して、スコープをアプリケーションのみに制限します。
directoryScopeId または appScopeId が必要です。 |
appScopeId |
String |
割り当てがアプリにスコープ設定されている場合のアプリ固有のスコープの識別子。 割り当てのスコープによって、プリンシパルにアクセス権が付与されているリソースのセットが決まります。 アプリ スコープは、このアプリケーションによってのみ定義および理解されるスコープです。 テナント全体のアプリ スコープに / を使用します。
directoryScopeId を使用して、スコープを特定のディレクトリ オブジェクト (管理単位など) に制限します。
directoryScopeId または appScopeId が必要です。 |
ジャスティフィケーション |
String |
unifiedRoleAssignmentScheduleRequest オブジェクトを作成するときに、ユーザーと管理者によって提供されるメッセージ。
selfDeactivate アクションとadminRemove アクションの場合は省略可能です。または、Microsoft Entra ロールにリンクされているポリシーのルールによっては、他のアクションの種類に必要な場合があります。 詳細については、「 PIM のルール」を参照してください。 |
scheduleInfo |
requestSchedule |
ロールの割り当て要求の期間。 定期的なスケジュールは現在サポートされていません。 必須です。 |
ticketInfo |
ticketInfo |
チケット番号とチケット システムの詳細を含む、ロール割り当て要求にリンクされたチケットの詳細。
selfDeactivate アクションとadminRemove アクションの場合は省略可能です。または、Microsoft Entra ロールにリンクされているポリシーのルールによっては、他のアクションの種類に必要な場合があります。 詳細については、「 PIM のルール」を参照してください。 |
応答
成功した場合、このメソッドは 201 Created
応答コードと、応答本文の unifiedRoleAssignmentScheduleRequest オブジェクトを返します。
例
例 1: ディレクトリ ロールをプリンシパルに割り当てる管理
次の要求では、管理者は ID 071cc716-8147-4397-a5ba-b2105951cc0b
で識別されるプリンシパルにfdd7a751-b60b-444a-984c-02652fe8fa1c
によって識別されるロールを割り当てる要求を作成します。 ロールのスコープはテナント内のすべてのディレクトリ オブジェクトであり、割り当ては永続的です。
要求
POST https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignmentScheduleRequests
Content-Type: application/json
{
"action": "adminAssign",
"justification": "Assign Groups Admin to IT Helpdesk group",
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",
"directoryScopeId": "/",
"principalId": "071cc716-8147-4397-a5ba-b2105951cc0b",
"scheduleInfo": {
"startDateTime": "2022-04-10T00:00:00Z",
"expiration": {
"type": "NoExpiration"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new UnifiedRoleAssignmentScheduleRequest
{
Action = UnifiedRoleScheduleRequestActions.AdminAssign,
Justification = "Assign Groups Admin to IT Helpdesk group",
RoleDefinitionId = "fdd7a751-b60b-444a-984c-02652fe8fa1c",
DirectoryScopeId = "/",
PrincipalId = "071cc716-8147-4397-a5ba-b2105951cc0b",
ScheduleInfo = new RequestSchedule
{
StartDateTime = DateTimeOffset.Parse("2022-04-10T00:00:00Z"),
Expiration = new ExpirationPattern
{
Type = ExpirationPatternType.NoExpiration,
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.RoleManagement.Directory.RoleAssignmentScheduleRequests.PostAsync(requestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
mgc role-management directory role-assignment-schedule-requests create --body '{\
"action": "adminAssign",\
"justification": "Assign Groups Admin to IT Helpdesk group",\
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",\
"directoryScopeId": "/",\
"principalId": "071cc716-8147-4397-a5ba-b2105951cc0b",\
"scheduleInfo": {\
"startDateTime": "2022-04-10T00:00:00Z",\
"expiration": {\
"type": "NoExpiration"\
}\
}\
}\
'
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewUnifiedRoleAssignmentScheduleRequest()
action := graphmodels.ADMINASSIGN_UNIFIEDROLESCHEDULEREQUESTACTIONS
requestBody.SetAction(&action)
justification := "Assign Groups Admin to IT Helpdesk group"
requestBody.SetJustification(&justification)
roleDefinitionId := "fdd7a751-b60b-444a-984c-02652fe8fa1c"
requestBody.SetRoleDefinitionId(&roleDefinitionId)
directoryScopeId := "/"
requestBody.SetDirectoryScopeId(&directoryScopeId)
principalId := "071cc716-8147-4397-a5ba-b2105951cc0b"
requestBody.SetPrincipalId(&principalId)
scheduleInfo := graphmodels.NewRequestSchedule()
startDateTime , err := time.Parse(time.RFC3339, "2022-04-10T00:00:00Z")
scheduleInfo.SetStartDateTime(&startDateTime)
expiration := graphmodels.NewExpirationPattern()
type := graphmodels.NOEXPIRATION_EXPIRATIONPATTERNTYPE
expiration.SetType(&type)
scheduleInfo.SetExpiration(expiration)
requestBody.SetScheduleInfo(scheduleInfo)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
roleAssignmentScheduleRequests, err := graphClient.RoleManagement().Directory().RoleAssignmentScheduleRequests().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UnifiedRoleAssignmentScheduleRequest unifiedRoleAssignmentScheduleRequest = new UnifiedRoleAssignmentScheduleRequest();
unifiedRoleAssignmentScheduleRequest.setAction(UnifiedRoleScheduleRequestActions.AdminAssign);
unifiedRoleAssignmentScheduleRequest.setJustification("Assign Groups Admin to IT Helpdesk group");
unifiedRoleAssignmentScheduleRequest.setRoleDefinitionId("fdd7a751-b60b-444a-984c-02652fe8fa1c");
unifiedRoleAssignmentScheduleRequest.setDirectoryScopeId("/");
unifiedRoleAssignmentScheduleRequest.setPrincipalId("071cc716-8147-4397-a5ba-b2105951cc0b");
RequestSchedule scheduleInfo = new RequestSchedule();
OffsetDateTime startDateTime = OffsetDateTime.parse("2022-04-10T00:00:00Z");
scheduleInfo.setStartDateTime(startDateTime);
ExpirationPattern expiration = new ExpirationPattern();
expiration.setType(ExpirationPatternType.NoExpiration);
scheduleInfo.setExpiration(expiration);
unifiedRoleAssignmentScheduleRequest.setScheduleInfo(scheduleInfo);
UnifiedRoleAssignmentScheduleRequest result = graphClient.roleManagement().directory().roleAssignmentScheduleRequests().post(unifiedRoleAssignmentScheduleRequest);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const unifiedRoleAssignmentScheduleRequest = {
action: 'adminAssign',
justification: 'Assign Groups Admin to IT Helpdesk group',
roleDefinitionId: 'fdd7a751-b60b-444a-984c-02652fe8fa1c',
directoryScopeId: '/',
principalId: '071cc716-8147-4397-a5ba-b2105951cc0b',
scheduleInfo: {
startDateTime: '2022-04-10T00:00:00Z',
expiration: {
type: 'NoExpiration'
}
}
};
await client.api('/roleManagement/directory/roleAssignmentScheduleRequests')
.post(unifiedRoleAssignmentScheduleRequest);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequest;
use Microsoft\Graph\Generated\Models\UnifiedRoleScheduleRequestActions;
use Microsoft\Graph\Generated\Models\RequestSchedule;
use Microsoft\Graph\Generated\Models\ExpirationPattern;
use Microsoft\Graph\Generated\Models\ExpirationPatternType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UnifiedRoleAssignmentScheduleRequest();
$requestBody->setAction(new UnifiedRoleScheduleRequestActions('adminAssign'));
$requestBody->setJustification('Assign Groups Admin to IT Helpdesk group');
$requestBody->setRoleDefinitionId('fdd7a751-b60b-444a-984c-02652fe8fa1c');
$requestBody->setDirectoryScopeId('/');
$requestBody->setPrincipalId('071cc716-8147-4397-a5ba-b2105951cc0b');
$scheduleInfo = new RequestSchedule();
$scheduleInfo->setStartDateTime(new \DateTime('2022-04-10T00:00:00Z'));
$scheduleInfoExpiration = new ExpirationPattern();
$scheduleInfoExpiration->setType(new ExpirationPatternType('noExpiration'));
$scheduleInfo->setExpiration($scheduleInfoExpiration);
$requestBody->setScheduleInfo($scheduleInfo);
$result = $graphServiceClient->roleManagement()->directory()->roleAssignmentScheduleRequests()->post($requestBody)->wait();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.Identity.Governance
$params = @{
action = "adminAssign"
justification = "Assign Groups Admin to IT Helpdesk group"
roleDefinitionId = "fdd7a751-b60b-444a-984c-02652fe8fa1c"
directoryScopeId = "/"
principalId = "071cc716-8147-4397-a5ba-b2105951cc0b"
scheduleInfo = @{
startDateTime = [System.DateTime]::Parse("2022-04-10T00:00:00Z")
expiration = @{
type = "NoExpiration"
}
}
}
New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest -BodyParameter $params
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.unified_role_assignment_schedule_request import UnifiedRoleAssignmentScheduleRequest
from msgraph.generated.models.unified_role_schedule_request_actions import UnifiedRoleScheduleRequestActions
from msgraph.generated.models.request_schedule import RequestSchedule
from msgraph.generated.models.expiration_pattern import ExpirationPattern
from msgraph.generated.models.expiration_pattern_type import ExpirationPatternType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UnifiedRoleAssignmentScheduleRequest(
action = UnifiedRoleScheduleRequestActions.AdminAssign,
justification = "Assign Groups Admin to IT Helpdesk group",
role_definition_id = "fdd7a751-b60b-444a-984c-02652fe8fa1c",
directory_scope_id = "/",
principal_id = "071cc716-8147-4397-a5ba-b2105951cc0b",
schedule_info = RequestSchedule(
start_date_time = "2022-04-10T00:00:00Z",
expiration = ExpirationPattern(
type = ExpirationPatternType.NoExpiration,
),
),
)
result = await graph_client.role_management.directory.role_assignment_schedule_requests.post(request_body)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#roleManagement/directory/roleAssignmentScheduleRequests/$entity",
"id": "95c690fb-3eb3-4942-a03f-4524aed6f31e",
"status": "Provisioned",
"createdDateTime": "2022-04-11T11:50:03.9014347Z",
"completedDateTime": "2022-04-11T11:50:05.9999343Z",
"approvalId": null,
"customData": null,
"action": "adminAssign",
"principalId": "071cc716-8147-4397-a5ba-b2105951cc0b",
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",
"directoryScopeId": "/",
"appScopeId": null,
"isValidationOnly": false,
"targetScheduleId": "95c690fb-3eb3-4942-a03f-4524aed6f31e",
"justification": "Assign Groups Admin to IT Helpdesk group",
"createdBy": {
"application": null,
"device": null,
"user": {
"displayName": null,
"id": "3fbd929d-8c56-4462-851e-0eb9a7b3a2a5"
}
},
"scheduleInfo": {
"startDateTime": "2022-04-11T11:50:05.9999343Z",
"recurrence": null,
"expiration": {
"type": "noExpiration",
"endDateTime": null,
"duration": null
}
},
"ticketInfo": {
"ticketNumber": null,
"ticketSystem": null
}
}
例 2: 資格のあるロールをアクティブ化するユーザー
要求
次の要求では、principalId071cc716-8147-4397-a5ba-b2105951cc0b
によって識別されたユーザーが、ID 8424c6f0-a189-499e-bbd0-26c1753c96d4
によって識別されるMicrosoft Entra ロールに対して、自分の適格なロールをアクティブ化します。 ロールのスコープはテナント内のすべてのディレクトリ オブジェクトであり、割り当ては 5 時間です。 この要求を実行するには、呼び出し元のユーザーに多要素認証 (MFA) が適用され、MFA に対してチャレンジされたセッションでクエリを実行する必要があります。
適格性要求の詳細を取得し、アクティブ化する資格を特定するために、ユーザーは unifiedRoleEligibilitySchedule: filterByCurrentUser API を 呼び出します。
POST https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignmentScheduleRequests/
Content-Type: application/json
{
"action": "selfActivate",
"principalId": "071cc716-8147-4397-a5ba-b2105951cc0b",
"roleDefinitionId": "8424c6f0-a189-499e-bbd0-26c1753c96d4",
"directoryScopeId": "/",
"justification": "I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs",
"scheduleInfo": {
"startDateTime": "2022-04-14T00:00:00.000Z",
"expiration": {
"type": "AfterDuration",
"duration": "PT5H"
}
},
"ticketInfo": {
"ticketNumber": "CONTOSO:Normal-67890",
"ticketSystem": "MS Project"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new UnifiedRoleAssignmentScheduleRequest
{
Action = UnifiedRoleScheduleRequestActions.SelfActivate,
PrincipalId = "071cc716-8147-4397-a5ba-b2105951cc0b",
RoleDefinitionId = "8424c6f0-a189-499e-bbd0-26c1753c96d4",
DirectoryScopeId = "/",
Justification = "I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs",
ScheduleInfo = new RequestSchedule
{
StartDateTime = DateTimeOffset.Parse("2022-04-14T00:00:00.000Z"),
Expiration = new ExpirationPattern
{
Type = ExpirationPatternType.AfterDuration,
Duration = TimeSpan.Parse("PT5H"),
},
},
TicketInfo = new TicketInfo
{
TicketNumber = "CONTOSO:Normal-67890",
TicketSystem = "MS Project",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.RoleManagement.Directory.RoleAssignmentScheduleRequests.PostAsync(requestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
mgc role-management directory role-assignment-schedule-requests create --body '{\
"action": "selfActivate",\
"principalId": "071cc716-8147-4397-a5ba-b2105951cc0b",\
"roleDefinitionId": "8424c6f0-a189-499e-bbd0-26c1753c96d4",\
"directoryScopeId": "/",\
"justification": "I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs",\
"scheduleInfo": {\
"startDateTime": "2022-04-14T00:00:00.000Z",\
"expiration": {\
"type": "AfterDuration",\
"duration": "PT5H"\
}\
},\
"ticketInfo": {\
"ticketNumber": "CONTOSO:Normal-67890",\
"ticketSystem": "MS Project"\
}\
}\
'
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewUnifiedRoleAssignmentScheduleRequest()
action := graphmodels.SELFACTIVATE_UNIFIEDROLESCHEDULEREQUESTACTIONS
requestBody.SetAction(&action)
principalId := "071cc716-8147-4397-a5ba-b2105951cc0b"
requestBody.SetPrincipalId(&principalId)
roleDefinitionId := "8424c6f0-a189-499e-bbd0-26c1753c96d4"
requestBody.SetRoleDefinitionId(&roleDefinitionId)
directoryScopeId := "/"
requestBody.SetDirectoryScopeId(&directoryScopeId)
justification := "I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs"
requestBody.SetJustification(&justification)
scheduleInfo := graphmodels.NewRequestSchedule()
startDateTime , err := time.Parse(time.RFC3339, "2022-04-14T00:00:00.000Z")
scheduleInfo.SetStartDateTime(&startDateTime)
expiration := graphmodels.NewExpirationPattern()
type := graphmodels.AFTERDURATION_EXPIRATIONPATTERNTYPE
expiration.SetType(&type)
duration , err := abstractions.ParseISODuration("PT5H")
expiration.SetDuration(&duration)
scheduleInfo.SetExpiration(expiration)
requestBody.SetScheduleInfo(scheduleInfo)
ticketInfo := graphmodels.NewTicketInfo()
ticketNumber := "CONTOSO:Normal-67890"
ticketInfo.SetTicketNumber(&ticketNumber)
ticketSystem := "MS Project"
ticketInfo.SetTicketSystem(&ticketSystem)
requestBody.SetTicketInfo(ticketInfo)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
roleAssignmentScheduleRequests, err := graphClient.RoleManagement().Directory().RoleAssignmentScheduleRequests().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UnifiedRoleAssignmentScheduleRequest unifiedRoleAssignmentScheduleRequest = new UnifiedRoleAssignmentScheduleRequest();
unifiedRoleAssignmentScheduleRequest.setAction(UnifiedRoleScheduleRequestActions.SelfActivate);
unifiedRoleAssignmentScheduleRequest.setPrincipalId("071cc716-8147-4397-a5ba-b2105951cc0b");
unifiedRoleAssignmentScheduleRequest.setRoleDefinitionId("8424c6f0-a189-499e-bbd0-26c1753c96d4");
unifiedRoleAssignmentScheduleRequest.setDirectoryScopeId("/");
unifiedRoleAssignmentScheduleRequest.setJustification("I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs");
RequestSchedule scheduleInfo = new RequestSchedule();
OffsetDateTime startDateTime = OffsetDateTime.parse("2022-04-14T00:00:00.000Z");
scheduleInfo.setStartDateTime(startDateTime);
ExpirationPattern expiration = new ExpirationPattern();
expiration.setType(ExpirationPatternType.AfterDuration);
PeriodAndDuration duration = PeriodAndDuration.ofDuration(Duration.parse("PT5H"));
expiration.setDuration(duration);
scheduleInfo.setExpiration(expiration);
unifiedRoleAssignmentScheduleRequest.setScheduleInfo(scheduleInfo);
TicketInfo ticketInfo = new TicketInfo();
ticketInfo.setTicketNumber("CONTOSO:Normal-67890");
ticketInfo.setTicketSystem("MS Project");
unifiedRoleAssignmentScheduleRequest.setTicketInfo(ticketInfo);
UnifiedRoleAssignmentScheduleRequest result = graphClient.roleManagement().directory().roleAssignmentScheduleRequests().post(unifiedRoleAssignmentScheduleRequest);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const unifiedRoleAssignmentScheduleRequest = {
action: 'selfActivate',
principalId: '071cc716-8147-4397-a5ba-b2105951cc0b',
roleDefinitionId: '8424c6f0-a189-499e-bbd0-26c1753c96d4',
directoryScopeId: '/',
justification: 'I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs',
scheduleInfo: {
startDateTime: '2022-04-14T00:00:00.000Z',
expiration: {
type: 'AfterDuration',
duration: 'PT5H'
}
},
ticketInfo: {
ticketNumber: 'CONTOSO:Normal-67890',
ticketSystem: 'MS Project'
}
};
await client.api('/roleManagement/directory/roleAssignmentScheduleRequests/')
.post(unifiedRoleAssignmentScheduleRequest);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\UnifiedRoleAssignmentScheduleRequest;
use Microsoft\Graph\Generated\Models\UnifiedRoleScheduleRequestActions;
use Microsoft\Graph\Generated\Models\RequestSchedule;
use Microsoft\Graph\Generated\Models\ExpirationPattern;
use Microsoft\Graph\Generated\Models\ExpirationPatternType;
use Microsoft\Graph\Generated\Models\TicketInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UnifiedRoleAssignmentScheduleRequest();
$requestBody->setAction(new UnifiedRoleScheduleRequestActions('selfActivate'));
$requestBody->setPrincipalId('071cc716-8147-4397-a5ba-b2105951cc0b');
$requestBody->setRoleDefinitionId('8424c6f0-a189-499e-bbd0-26c1753c96d4');
$requestBody->setDirectoryScopeId('/');
$requestBody->setJustification('I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs');
$scheduleInfo = new RequestSchedule();
$scheduleInfo->setStartDateTime(new \DateTime('2022-04-14T00:00:00.000Z'));
$scheduleInfoExpiration = new ExpirationPattern();
$scheduleInfoExpiration->setType(new ExpirationPatternType('afterDuration'));
$scheduleInfoExpiration->setDuration(new \DateInterval('PT5H'));
$scheduleInfo->setExpiration($scheduleInfoExpiration);
$requestBody->setScheduleInfo($scheduleInfo);
$ticketInfo = new TicketInfo();
$ticketInfo->setTicketNumber('CONTOSO:Normal-67890');
$ticketInfo->setTicketSystem('MS Project');
$requestBody->setTicketInfo($ticketInfo);
$result = $graphServiceClient->roleManagement()->directory()->roleAssignmentScheduleRequests()->post($requestBody)->wait();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.Identity.Governance
$params = @{
action = "selfActivate"
principalId = "071cc716-8147-4397-a5ba-b2105951cc0b"
roleDefinitionId = "8424c6f0-a189-499e-bbd0-26c1753c96d4"
directoryScopeId = "/"
justification = "I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs"
scheduleInfo = @{
startDateTime = [System.DateTime]::Parse("2022-04-14T00:00:00.000Z")
expiration = @{
type = "AfterDuration"
duration = "PT5H"
}
}
ticketInfo = @{
ticketNumber = "CONTOSO:Normal-67890"
ticketSystem = "MS Project"
}
}
New-MgRoleManagementDirectoryRoleAssignmentScheduleRequest -BodyParameter $params
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.unified_role_assignment_schedule_request import UnifiedRoleAssignmentScheduleRequest
from msgraph.generated.models.unified_role_schedule_request_actions import UnifiedRoleScheduleRequestActions
from msgraph.generated.models.request_schedule import RequestSchedule
from msgraph.generated.models.expiration_pattern import ExpirationPattern
from msgraph.generated.models.expiration_pattern_type import ExpirationPatternType
from msgraph.generated.models.ticket_info import TicketInfo
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UnifiedRoleAssignmentScheduleRequest(
action = UnifiedRoleScheduleRequestActions.SelfActivate,
principal_id = "071cc716-8147-4397-a5ba-b2105951cc0b",
role_definition_id = "8424c6f0-a189-499e-bbd0-26c1753c96d4",
directory_scope_id = "/",
justification = "I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs",
schedule_info = RequestSchedule(
start_date_time = "2022-04-14T00:00:00.000Z",
expiration = ExpirationPattern(
type = ExpirationPatternType.AfterDuration,
duration = "PT5H",
),
),
ticket_info = TicketInfo(
ticket_number = "CONTOSO:Normal-67890",
ticket_system = "MS Project",
),
)
result = await graph_client.role_management.directory.role_assignment_schedule_requests.post(request_body)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#roleManagement/directory/roleAssignmentScheduleRequests/$entity",
"id": "911bab8a-6912-4de2-9dc0-2648ede7dd6d",
"status": "Granted",
"createdDateTime": "2022-04-13T08:52:32.6485851Z",
"completedDateTime": "2022-04-14T00:00:00Z",
"approvalId": null,
"customData": null,
"action": "selfActivate",
"principalId": "071cc716-8147-4397-a5ba-b2105951cc0b",
"roleDefinitionId": "8424c6f0-a189-499e-bbd0-26c1753c96d4",
"directoryScopeId": "/",
"appScopeId": null,
"isValidationOnly": false,
"targetScheduleId": "911bab8a-6912-4de2-9dc0-2648ede7dd6d",
"justification": "I need access to the Attribute Administrator role to manage attributes to be assigned to restricted AUs",
"createdBy": {
"application": null,
"device": null,
"user": {
"displayName": null,
"id": "071cc716-8147-4397-a5ba-b2105951cc0b"
}
},
"scheduleInfo": {
"startDateTime": "2022-04-14T00:00:00Z",
"recurrence": null,
"expiration": {
"type": "afterDuration",
"endDateTime": null,
"duration": "PT5H"
}
},
"ticketInfo": {
"ticketNumber": "CONTOSO:Normal-67890",
"ticketSystem": "MS Project"
}
}