Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create a new unifiedRoleEligibilityScheduleRequest object. This operation allows both admins and eligible users to add, revoke, or extend eligible assignments.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
RoleEligibilitySchedule.ReadWrite.Directory |
RoleManagement.ReadWrite.Directory |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
RoleEligibilitySchedule.ReadWrite.Directory |
RoleManagement.ReadWrite.Directory |
Important
In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation.
- For read operations: Global Reader, Security Operator, Security Reader, Security Administrator, or Privileged Role Administrator
- For write operations: Privileged Role Administrator
HTTP request
POST /roleManagement/directory/roleEligibilityScheduleRequests
Request body
In the request body, supply a JSON representation of the unifiedRoleEligibilityScheduleRequest object.
The following table shows the optional and required properties when you create the unifiedRoleEligibilityScheduleRequest.
Property |
Type |
Description |
action |
String |
Represents the type of the operation on the role eligibility assignment. The possible values are: AdminAssign : For administrators to assign role eligibility to users or groups to roles.AdminExtend : For administrators to extend expiring assignments.AdminUpdate : For administrators to change existing role assignments.AdminRenew : For administrators to renew expired assignments.AdminRemove : For administrators to remove users or groups from eligible roles.UserAdd : For users to activate their eligible assignments.UserExtend : For users to request to extend their expiring eligible assignments.UserRemove : For users to deactivate their active eligible assignments.UserRenew : For users to request to renew their expired eligible assignments.
|
appScopeId |
String |
Identifier of the app-specific scope when the assignment scope is app-specific. The scope of an assignment determines the set of resources for which the principal has been granted access. App scopes are scopes that are defined and understood by this application only. Use / for tenant-wide app scopes. Use directoryScopeId to limit the scope to particular directory objects, for example, administrative units or all users. |
directoryScopeId |
String |
Identifier of the directory object representing the scope of the assignment. The scope of an assignment determines the set of resources for which the principal has been granted access. Directory scopes are shared scopes stored in the directory that are understood by multiple applications. Use / for tenant-wide scope. Use appScopeId to limit the scope to an application only. |
isValidationOnly |
Boolean |
A Boolean that determines whether the call is a validation or an actual call. Only set this property if you want to check whether an activation is subject to additional rules like MFA before actually submitting the request. |
justification |
String |
A message provided by users and administrators when create the request about why it is needed. Optional when action is AdminRemove . |
principalId |
String |
Identifier of the principal to which the assignment is being granted to. For example, a user or a group. For groups, they must be assignable to roles, that is, the isAssignableToRole of the group property set to true . |
roleDefinitionId |
String |
Identifier of the unifiedRoleDefinition the assignment is for. Required. Read only. |
scheduleInfo |
requestSchedule |
The schedule object of the role assignment request. This property is not required when the action is AdminRemove . |
ticketInfo |
ticketInfo |
The ticketInfo object attached to the role assignment request which includes details of the ticket number and ticket system. Optional. |
Response
If successful, this method returns a 201 Created
response code and an unifiedRoleEligibilityScheduleRequest object in the response body.
Examples
Example 1: Admin to assign a role eligibility schedule request
In the following request, the admin creates a request to assign eligibility of a role identified by fdd7a751-b60b-444a-984c-02652fe8fa1c
to a principal identified by id 07706ff1-46c7-4847-ae33-3003830675a1
. The scope of the eligibility is all directory objects in the tenant until June 30, 2022 at midnight UTC time.
Request
POST https://graph.microsoft.com/beta/roleManagement/directory/roleEligibilityScheduleRequests
Content-Type: application/json
{
"action": "AdminAssign",
"justification": "Assign User Admin eligibility to IT Helpdesk (User) group",
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",
"directoryScopeId": "/",
"principalId": "07706ff1-46c7-4847-ae33-3003830675a1",
"scheduleInfo": {
"startDateTime": "2021-07-01T00:00:00Z",
"expiration": {
"endDateTime": "2022-06-30T00:00:00Z",
"type": "AfterDateTime"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new UnifiedRoleEligibilityScheduleRequest
{
Action = "AdminAssign",
Justification = "Assign User Admin eligibility to IT Helpdesk (User) group",
RoleDefinitionId = "fdd7a751-b60b-444a-984c-02652fe8fa1c",
DirectoryScopeId = "/",
PrincipalId = "07706ff1-46c7-4847-ae33-3003830675a1",
ScheduleInfo = new RequestSchedule
{
StartDateTime = DateTimeOffset.Parse("2021-07-01T00:00:00Z"),
Expiration = new ExpirationPattern
{
EndDateTime = DateTimeOffset.Parse("2022-06-30T00:00:00Z"),
Type = ExpirationPatternType.AfterDateTime,
},
},
};
// 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.RoleEligibilityScheduleRequests.PostAsync(requestBody);
mgc-beta role-management directory role-eligibility-schedule-requests create --body '{\
"action": "AdminAssign",\
"justification": "Assign User Admin eligibility to IT Helpdesk (User) group",\
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",\
"directoryScopeId": "/",\
"principalId": "07706ff1-46c7-4847-ae33-3003830675a1",\
"scheduleInfo": {\
"startDateTime": "2021-07-01T00:00:00Z",\
"expiration": {\
"endDateTime": "2022-06-30T00:00:00Z",\
"type": "AfterDateTime"\
}\
}\
}\
'
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewUnifiedRoleEligibilityScheduleRequest()
action := "AdminAssign"
requestBody.SetAction(&action)
justification := "Assign User Admin eligibility to IT Helpdesk (User) group"
requestBody.SetJustification(&justification)
roleDefinitionId := "fdd7a751-b60b-444a-984c-02652fe8fa1c"
requestBody.SetRoleDefinitionId(&roleDefinitionId)
directoryScopeId := "/"
requestBody.SetDirectoryScopeId(&directoryScopeId)
principalId := "07706ff1-46c7-4847-ae33-3003830675a1"
requestBody.SetPrincipalId(&principalId)
scheduleInfo := graphmodels.NewRequestSchedule()
startDateTime , err := time.Parse(time.RFC3339, "2021-07-01T00:00:00Z")
scheduleInfo.SetStartDateTime(&startDateTime)
expiration := graphmodels.NewExpirationPattern()
endDateTime , err := time.Parse(time.RFC3339, "2022-06-30T00:00:00Z")
expiration.SetEndDateTime(&endDateTime)
type := graphmodels.AFTERDATETIME_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
roleEligibilityScheduleRequests, err := graphClient.RoleManagement().Directory().RoleEligibilityScheduleRequests().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UnifiedRoleEligibilityScheduleRequest unifiedRoleEligibilityScheduleRequest = new UnifiedRoleEligibilityScheduleRequest();
unifiedRoleEligibilityScheduleRequest.setAction("AdminAssign");
unifiedRoleEligibilityScheduleRequest.setJustification("Assign User Admin eligibility to IT Helpdesk (User) group");
unifiedRoleEligibilityScheduleRequest.setRoleDefinitionId("fdd7a751-b60b-444a-984c-02652fe8fa1c");
unifiedRoleEligibilityScheduleRequest.setDirectoryScopeId("/");
unifiedRoleEligibilityScheduleRequest.setPrincipalId("07706ff1-46c7-4847-ae33-3003830675a1");
RequestSchedule scheduleInfo = new RequestSchedule();
OffsetDateTime startDateTime = OffsetDateTime.parse("2021-07-01T00:00:00Z");
scheduleInfo.setStartDateTime(startDateTime);
ExpirationPattern expiration = new ExpirationPattern();
OffsetDateTime endDateTime = OffsetDateTime.parse("2022-06-30T00:00:00Z");
expiration.setEndDateTime(endDateTime);
expiration.setType(ExpirationPatternType.AfterDateTime);
scheduleInfo.setExpiration(expiration);
unifiedRoleEligibilityScheduleRequest.setScheduleInfo(scheduleInfo);
UnifiedRoleEligibilityScheduleRequest result = graphClient.roleManagement().directory().roleEligibilityScheduleRequests().post(unifiedRoleEligibilityScheduleRequest);
const options = {
authProvider,
};
const client = Client.init(options);
const unifiedRoleEligibilityScheduleRequest = {
action: 'AdminAssign',
justification: 'Assign User Admin eligibility to IT Helpdesk (User) group',
roleDefinitionId: 'fdd7a751-b60b-444a-984c-02652fe8fa1c',
directoryScopeId: '/',
principalId: '07706ff1-46c7-4847-ae33-3003830675a1',
scheduleInfo: {
startDateTime: '2021-07-01T00:00:00Z',
expiration: {
endDateTime: '2022-06-30T00:00:00Z',
type: 'AfterDateTime'
}
}
};
await client.api('/roleManagement/directory/roleEligibilityScheduleRequests')
.version('beta')
.post(unifiedRoleEligibilityScheduleRequest);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\UnifiedRoleEligibilityScheduleRequest;
use Microsoft\Graph\Beta\Generated\Models\RequestSchedule;
use Microsoft\Graph\Beta\Generated\Models\ExpirationPattern;
use Microsoft\Graph\Beta\Generated\Models\ExpirationPatternType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UnifiedRoleEligibilityScheduleRequest();
$requestBody->setAction('AdminAssign');
$requestBody->setJustification('Assign User Admin eligibility to IT Helpdesk (User) group');
$requestBody->setRoleDefinitionId('fdd7a751-b60b-444a-984c-02652fe8fa1c');
$requestBody->setDirectoryScopeId('/');
$requestBody->setPrincipalId('07706ff1-46c7-4847-ae33-3003830675a1');
$scheduleInfo = new RequestSchedule();
$scheduleInfo->setStartDateTime(new \DateTime('2021-07-01T00:00:00Z'));
$scheduleInfoExpiration = new ExpirationPattern();
$scheduleInfoExpiration->setEndDateTime(new \DateTime('2022-06-30T00:00:00Z'));
$scheduleInfoExpiration->setType(new ExpirationPatternType('afterDateTime'));
$scheduleInfo->setExpiration($scheduleInfoExpiration);
$requestBody->setScheduleInfo($scheduleInfo);
$result = $graphServiceClient->roleManagement()->directory()->roleEligibilityScheduleRequests()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.Governance
$params = @{
action = "AdminAssign"
justification = "Assign User Admin eligibility to IT Helpdesk (User) group"
roleDefinitionId = "fdd7a751-b60b-444a-984c-02652fe8fa1c"
directoryScopeId = "/"
principalId = "07706ff1-46c7-4847-ae33-3003830675a1"
scheduleInfo = @{
startDateTime = [System.DateTime]::Parse("2021-07-01T00:00:00Z")
expiration = @{
endDateTime = [System.DateTime]::Parse("2022-06-30T00:00:00Z")
type = "AfterDateTime"
}
}
}
New-MgBetaRoleManagementDirectoryRoleEligibilityScheduleRequest -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.unified_role_eligibility_schedule_request import UnifiedRoleEligibilityScheduleRequest
from msgraph_beta.generated.models.request_schedule import RequestSchedule
from msgraph_beta.generated.models.expiration_pattern import ExpirationPattern
from msgraph_beta.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 = UnifiedRoleEligibilityScheduleRequest(
action = "AdminAssign",
justification = "Assign User Admin eligibility to IT Helpdesk (User) group",
role_definition_id = "fdd7a751-b60b-444a-984c-02652fe8fa1c",
directory_scope_id = "/",
principal_id = "07706ff1-46c7-4847-ae33-3003830675a1",
schedule_info = RequestSchedule(
start_date_time = "2021-07-01T00:00:00Z",
expiration = ExpirationPattern(
end_date_time = "2022-06-30T00:00:00Z",
type = ExpirationPatternType.AfterDateTime,
),
),
)
result = await graph_client.role_management.directory.role_eligibility_schedule_requests.post(request_body)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/directory/roleEligibilityScheduleRequests/$entity",
"id": "672c03bf-226a-42ec-a8b7-3bfab96064a1",
"status": "Provisioned",
"createdDateTime": "2021-07-26T18:08:03.1299669Z",
"completedDateTime": "2021-07-26T18:08:06.2081758Z",
"approvalId": null,
"customData": null,
"action": "AdminAssign",
"principalId": "07706ff1-46c7-4847-ae33-3003830675a1",
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",
"directoryScopeId": "/",
"appScopeId": null,
"isValidationOnly": false,
"targetScheduleId": "672c03bf-226a-42ec-a8b7-3bfab96064a1",
"justification": "Assign User Admin eligibility to IT Helpdesk (User) group",
"createdBy": {
"application": null,
"device": null,
"user": {
"displayName": null,
"id": "fc9a2c2b-1ddc-486d-a211-5fe8ca77fa1f"
}
},
"scheduleInfo": {
"startDateTime": "2021-07-26T18:08:06.2081758Z",
"recurrence": null,
"expiration": {
"type": "afterDateTime",
"endDateTime": "2022-06-30T00:00:00Z",
"duration": null
}
},
"ticketInfo": {
"ticketNumber": null,
"ticketSystem": null
}
}
Example 2: Admin to remove an existing role eligibility schedule request
In the following request, the admin creates a request to revoke the eligibility of a role identified by fdd7a751-b60b-444a-984c-02652fe8fa1c
to a principal identified by id 07706ff1-46c7-4847-ae33-3003830675a1
.
Request
POST https://graph.microsoft.com/beta/roleManagement/directory/roleEligibilityScheduleRequests
Content-Type: application/json
{
"action": "AdminRemove",
"justification": "Assign User Admin eligibility to IT Helpdesk (User) group",
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",
"directoryScopeId": "/",
"principalId": "07706ff1-46c7-4847-ae33-3003830675a1",
"scheduleInfo": {
"startDateTime": "2021-07-26T18:08:06.2081758Z",
"expiration": {
"endDateTime": "2022-06-30T00:00:00Z",
"type": "AfterDateTime"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new UnifiedRoleEligibilityScheduleRequest
{
Action = "AdminRemove",
Justification = "Assign User Admin eligibility to IT Helpdesk (User) group",
RoleDefinitionId = "fdd7a751-b60b-444a-984c-02652fe8fa1c",
DirectoryScopeId = "/",
PrincipalId = "07706ff1-46c7-4847-ae33-3003830675a1",
ScheduleInfo = new RequestSchedule
{
StartDateTime = DateTimeOffset.Parse("2021-07-26T18:08:06.2081758Z"),
Expiration = new ExpirationPattern
{
EndDateTime = DateTimeOffset.Parse("2022-06-30T00:00:00Z"),
Type = ExpirationPatternType.AfterDateTime,
},
},
};
// 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.RoleEligibilityScheduleRequests.PostAsync(requestBody);
mgc-beta role-management directory role-eligibility-schedule-requests create --body '{\
"action": "AdminRemove",\
"justification": "Assign User Admin eligibility to IT Helpdesk (User) group",\
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",\
"directoryScopeId": "/",\
"principalId": "07706ff1-46c7-4847-ae33-3003830675a1",\
"scheduleInfo": {\
"startDateTime": "2021-07-26T18:08:06.2081758Z",\
"expiration": {\
"endDateTime": "2022-06-30T00:00:00Z",\
"type": "AfterDateTime"\
}\
}\
}\
'
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewUnifiedRoleEligibilityScheduleRequest()
action := "AdminRemove"
requestBody.SetAction(&action)
justification := "Assign User Admin eligibility to IT Helpdesk (User) group"
requestBody.SetJustification(&justification)
roleDefinitionId := "fdd7a751-b60b-444a-984c-02652fe8fa1c"
requestBody.SetRoleDefinitionId(&roleDefinitionId)
directoryScopeId := "/"
requestBody.SetDirectoryScopeId(&directoryScopeId)
principalId := "07706ff1-46c7-4847-ae33-3003830675a1"
requestBody.SetPrincipalId(&principalId)
scheduleInfo := graphmodels.NewRequestSchedule()
startDateTime , err := time.Parse(time.RFC3339, "2021-07-26T18:08:06.2081758Z")
scheduleInfo.SetStartDateTime(&startDateTime)
expiration := graphmodels.NewExpirationPattern()
endDateTime , err := time.Parse(time.RFC3339, "2022-06-30T00:00:00Z")
expiration.SetEndDateTime(&endDateTime)
type := graphmodels.AFTERDATETIME_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
roleEligibilityScheduleRequests, err := graphClient.RoleManagement().Directory().RoleEligibilityScheduleRequests().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
UnifiedRoleEligibilityScheduleRequest unifiedRoleEligibilityScheduleRequest = new UnifiedRoleEligibilityScheduleRequest();
unifiedRoleEligibilityScheduleRequest.setAction("AdminRemove");
unifiedRoleEligibilityScheduleRequest.setJustification("Assign User Admin eligibility to IT Helpdesk (User) group");
unifiedRoleEligibilityScheduleRequest.setRoleDefinitionId("fdd7a751-b60b-444a-984c-02652fe8fa1c");
unifiedRoleEligibilityScheduleRequest.setDirectoryScopeId("/");
unifiedRoleEligibilityScheduleRequest.setPrincipalId("07706ff1-46c7-4847-ae33-3003830675a1");
RequestSchedule scheduleInfo = new RequestSchedule();
OffsetDateTime startDateTime = OffsetDateTime.parse("2021-07-26T18:08:06.2081758Z");
scheduleInfo.setStartDateTime(startDateTime);
ExpirationPattern expiration = new ExpirationPattern();
OffsetDateTime endDateTime = OffsetDateTime.parse("2022-06-30T00:00:00Z");
expiration.setEndDateTime(endDateTime);
expiration.setType(ExpirationPatternType.AfterDateTime);
scheduleInfo.setExpiration(expiration);
unifiedRoleEligibilityScheduleRequest.setScheduleInfo(scheduleInfo);
UnifiedRoleEligibilityScheduleRequest result = graphClient.roleManagement().directory().roleEligibilityScheduleRequests().post(unifiedRoleEligibilityScheduleRequest);
const options = {
authProvider,
};
const client = Client.init(options);
const unifiedRoleEligibilityScheduleRequest = {
action: 'AdminRemove',
justification: 'Assign User Admin eligibility to IT Helpdesk (User) group',
roleDefinitionId: 'fdd7a751-b60b-444a-984c-02652fe8fa1c',
directoryScopeId: '/',
principalId: '07706ff1-46c7-4847-ae33-3003830675a1',
scheduleInfo: {
startDateTime: '2021-07-26T18:08:06.2081758Z',
expiration: {
endDateTime: '2022-06-30T00:00:00Z',
type: 'AfterDateTime'
}
}
};
await client.api('/roleManagement/directory/roleEligibilityScheduleRequests')
.version('beta')
.post(unifiedRoleEligibilityScheduleRequest);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\UnifiedRoleEligibilityScheduleRequest;
use Microsoft\Graph\Beta\Generated\Models\RequestSchedule;
use Microsoft\Graph\Beta\Generated\Models\ExpirationPattern;
use Microsoft\Graph\Beta\Generated\Models\ExpirationPatternType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UnifiedRoleEligibilityScheduleRequest();
$requestBody->setAction('AdminRemove');
$requestBody->setJustification('Assign User Admin eligibility to IT Helpdesk (User) group');
$requestBody->setRoleDefinitionId('fdd7a751-b60b-444a-984c-02652fe8fa1c');
$requestBody->setDirectoryScopeId('/');
$requestBody->setPrincipalId('07706ff1-46c7-4847-ae33-3003830675a1');
$scheduleInfo = new RequestSchedule();
$scheduleInfo->setStartDateTime(new \DateTime('2021-07-26T18:08:06.2081758Z'));
$scheduleInfoExpiration = new ExpirationPattern();
$scheduleInfoExpiration->setEndDateTime(new \DateTime('2022-06-30T00:00:00Z'));
$scheduleInfoExpiration->setType(new ExpirationPatternType('afterDateTime'));
$scheduleInfo->setExpiration($scheduleInfoExpiration);
$requestBody->setScheduleInfo($scheduleInfo);
$result = $graphServiceClient->roleManagement()->directory()->roleEligibilityScheduleRequests()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.Governance
$params = @{
action = "AdminRemove"
justification = "Assign User Admin eligibility to IT Helpdesk (User) group"
roleDefinitionId = "fdd7a751-b60b-444a-984c-02652fe8fa1c"
directoryScopeId = "/"
principalId = "07706ff1-46c7-4847-ae33-3003830675a1"
scheduleInfo = @{
startDateTime = [System.DateTime]::Parse("2021-07-26T18:08:06.2081758Z")
expiration = @{
endDateTime = [System.DateTime]::Parse("2022-06-30T00:00:00Z")
type = "AfterDateTime"
}
}
}
New-MgBetaRoleManagementDirectoryRoleEligibilityScheduleRequest -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.unified_role_eligibility_schedule_request import UnifiedRoleEligibilityScheduleRequest
from msgraph_beta.generated.models.request_schedule import RequestSchedule
from msgraph_beta.generated.models.expiration_pattern import ExpirationPattern
from msgraph_beta.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 = UnifiedRoleEligibilityScheduleRequest(
action = "AdminRemove",
justification = "Assign User Admin eligibility to IT Helpdesk (User) group",
role_definition_id = "fdd7a751-b60b-444a-984c-02652fe8fa1c",
directory_scope_id = "/",
principal_id = "07706ff1-46c7-4847-ae33-3003830675a1",
schedule_info = RequestSchedule(
start_date_time = "2021-07-26T18:08:06.2081758Z",
expiration = ExpirationPattern(
end_date_time = "2022-06-30T00:00:00Z",
type = ExpirationPatternType.AfterDateTime,
),
),
)
result = await graph_client.role_management.directory.role_eligibility_schedule_requests.post(request_body)
Response
The following example shows the response. The request returns a response object that shows the status of previously eligible assignment changes as Revoked
. The principal will no longer see their previously eligible role.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/directory/roleEligibilityScheduleRequests/$entity",
"id": "7f88a144-f9a9-4f8c-9623-39c321ae93c2",
"status": "Revoked",
"createdDateTime": "2021-08-06T17:59:12.4263499Z",
"completedDateTime": null,
"approvalId": null,
"customData": null,
"action": "AdminRemove",
"principalId": "07706ff1-46c7-4847-ae33-3003830675a1",
"roleDefinitionId": "fdd7a751-b60b-444a-984c-02652fe8fa1c",
"directoryScopeId": "/",
"appScopeId": null,
"isValidationOnly": false,
"targetScheduleId": null,
"justification": "Assign User Admin eligibility to IT Helpdesk (User) group",
"createdBy": {
"application": null,
"device": null,
"user": {
"displayName": null,
"id": "fc9a2c2b-1ddc-486d-a211-5fe8ca77fa1f"
}
},
"scheduleInfo": {
"startDateTime": "2021-07-26T18:08:06.2081758Z",
"recurrence": null,
"expiration": {
"type": "afterDateTime",
"endDateTime": "2022-06-30T00:00:00Z",
"duration": null
}
},
"ticketInfo": {
"ticketNumber": null,
"ticketSystem": null
}
}