Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
En escenarios delegados con cuentas profesionales o educativas, el usuario que ha iniciado sesión debe ser propietario o miembro del grupo o tener asignado un rol de Microsoft Entra compatible o un rol personalizado con un permiso de rol admitido. Se admiten los siguientes roles con privilegios mínimos para esta operación.
Para grupos a los que se pueden asignar roles: Administrador de roles con privilegios
Para grupos no asignables por roles: Escritor de directorios, administrador de Grupos, administrador de gobernanza de identidades o administrador de usuarios
Las asignaciones de roles para el usuario que realiza la llamada deben tener un ámbito en el nivel de directorio.
Otros roles con permisos para administrar grupos (como administradores de Exchange para grupos de Microsoft 365 no asignables a roles) y administradores con asignaciones con ámbito en el nivel de unidad administrativa pueden administrar grupos a través de la API de grupos e invalidar los cambios realizados en Microsoft Entra PIM a través de PIM para las API de grupos.
Solicitud HTTP
POST /identityGovernance/privilegedAccess/group/assignmentScheduleRequests
Puede especificar las siguientes propiedades al crear un privilegedAccessGroupAssignmentScheduleRequest.
Propiedad
Tipo
Descripción
accessId
privilegedAccessGroupRelationships
Identificador de la relación de pertenencia o asignación de propiedad con el grupo. Los valores posibles son: owner, member. Obligatorio.
acción
Cadena
Representa el tipo de la operación en la solicitud de asignación de pertenencia a grupos o propiedad. Los valores posibles son: adminAssign, adminUpdate, adminRemove, selfActivate, selfDeactivate, adminExtend y adminRenew.
adminAssign: para que los administradores asignen pertenencia a grupos o propiedad a entidades de seguridad.
adminRemove: para que los administradores quiten las entidades de seguridad de la pertenencia a grupos o de la propiedad.
adminUpdate: para que los administradores cambien la pertenencia a grupos o las asignaciones de propiedad existentes.
adminExtend: para que los administradores amplíen las asignaciones que expiran.
adminRenew: para que los administradores renueve las asignaciones expiradas.
selfActivate: para que las entidades de seguridad activen sus asignaciones.
selfDeactivate: para que las entidades de seguridad desactiven sus asignaciones activas.
Obligatorio.
customData
Cadena
Campo de texto libre para definir los datos personalizados de la solicitud. Opcional.
groupId
Cadena
Identificador del grupo que representa el ámbito de la asignación de pertenencia o propiedad a través de PIM para grupos. Obligatorio.
justificación
Cadena
Mensaje proporcionado por usuarios y administradores al crear el objeto privilegedAccessGroupAssignmentScheduleRequest . Opcional.
principalId
Cadena
Identificador de la entidad de seguridad cuya pertenencia o asignación de propiedad se concede a través de PIM para grupos. Obligatorio.
Detalles del vale vinculados a la solicitud de asignación de pertenencia a grupos o propiedad, incluidos los detalles del número de vale y del sistema de vales. Opcional.
Ejemplo 1: Creación de una solicitud de programación de asignación
La siguiente solicitud crea una solicitud de programación de asignación para asignar una pertenencia activa de entidad de seguridad al grupo especificado. La pertenencia activa expira después de dos horas.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new PrivilegedAccessGroupAssignmentScheduleRequest
{
AccessId = PrivilegedAccessGroupRelationships.Member,
PrincipalId = "3cce9d87-3986-4f19-8335-7ed075408ca2",
GroupId = "68e55cce-cf7e-4a2d-9046-3e4e75c4bfa7",
Action = ScheduleRequestActions.AdminAssign,
ScheduleInfo = new RequestSchedule
{
StartDateTime = DateTimeOffset.Parse("2022-12-08T07:43:00.000Z"),
Expiration = new ExpirationPattern
{
Type = ExpirationPatternType.AfterDuration,
Duration = TimeSpan.Parse("PT2H"),
},
},
Justification = "Assign active member access.",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.PrivilegedAccess.Group.AssignmentScheduleRequests.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrivilegedAccessGroupAssignmentScheduleRequest privilegedAccessGroupAssignmentScheduleRequest = new PrivilegedAccessGroupAssignmentScheduleRequest();
privilegedAccessGroupAssignmentScheduleRequest.setAccessId(PrivilegedAccessGroupRelationships.Member);
privilegedAccessGroupAssignmentScheduleRequest.setPrincipalId("3cce9d87-3986-4f19-8335-7ed075408ca2");
privilegedAccessGroupAssignmentScheduleRequest.setGroupId("68e55cce-cf7e-4a2d-9046-3e4e75c4bfa7");
privilegedAccessGroupAssignmentScheduleRequest.setAction(ScheduleRequestActions.AdminAssign);
RequestSchedule scheduleInfo = new RequestSchedule();
OffsetDateTime startDateTime = OffsetDateTime.parse("2022-12-08T07:43:00.000Z");
scheduleInfo.setStartDateTime(startDateTime);
ExpirationPattern expiration = new ExpirationPattern();
expiration.setType(ExpirationPatternType.AfterDuration);
PeriodAndDuration duration = PeriodAndDuration.ofDuration(Duration.parse("PT2H"));
expiration.setDuration(duration);
scheduleInfo.setExpiration(expiration);
privilegedAccessGroupAssignmentScheduleRequest.setScheduleInfo(scheduleInfo);
privilegedAccessGroupAssignmentScheduleRequest.setJustification("Assign active member access.");
PrivilegedAccessGroupAssignmentScheduleRequest result = graphClient.identityGovernance().privilegedAccess().group().assignmentScheduleRequests().post(privilegedAccessGroupAssignmentScheduleRequest);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupAssignmentScheduleRequest;
use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupRelationships;
use Microsoft\Graph\Generated\Models\ScheduleRequestActions;
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 PrivilegedAccessGroupAssignmentScheduleRequest();
$requestBody->setAccessId(new PrivilegedAccessGroupRelationships('member'));
$requestBody->setPrincipalId('3cce9d87-3986-4f19-8335-7ed075408ca2');
$requestBody->setGroupId('68e55cce-cf7e-4a2d-9046-3e4e75c4bfa7');
$requestBody->setAction(new ScheduleRequestActions('adminAssign'));
$scheduleInfo = new RequestSchedule();
$scheduleInfo->setStartDateTime(new \DateTime('2022-12-08T07:43:00.000Z'));
$scheduleInfoExpiration = new ExpirationPattern();
$scheduleInfoExpiration->setType(new ExpirationPatternType('afterDuration'));
$scheduleInfoExpiration->setDuration(new \DateInterval('PT2H'));
$scheduleInfo->setExpiration($scheduleInfoExpiration);
$requestBody->setScheduleInfo($scheduleInfo);
$requestBody->setJustification('Assign active member access.');
$result = $graphServiceClient->identityGovernance()->privilegedAccess()->group()->assignmentScheduleRequests()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.privileged_access_group_assignment_schedule_request import PrivilegedAccessGroupAssignmentScheduleRequest
from msgraph.generated.models.privileged_access_group_relationships import PrivilegedAccessGroupRelationships
from msgraph.generated.models.schedule_request_actions import ScheduleRequestActions
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 = PrivilegedAccessGroupAssignmentScheduleRequest(
access_id = PrivilegedAccessGroupRelationships.Member,
principal_id = "3cce9d87-3986-4f19-8335-7ed075408ca2",
group_id = "68e55cce-cf7e-4a2d-9046-3e4e75c4bfa7",
action = ScheduleRequestActions.AdminAssign,
schedule_info = RequestSchedule(
start_date_time = "2022-12-08T07:43:00.000Z",
expiration = ExpirationPattern(
type = ExpirationPatternType.AfterDuration,
duration = "PT2H",
),
),
justification = "Assign active member access.",
)
result = await graph_client.identity_governance.privileged_access.group.assignment_schedule_requests.post(request_body)
Ejemplo 2: El usuario activa su asignación apta para PIM para Grupos
En la siguiente solicitud, un usuario identificado por principalId3cce9d87-3986-4f19-8335-7ed075408ca2 activa su pertenencia apta a un grupo administrado por PIM identificado por groupId2b5ed229-4072-478d-9504-a047ebd4b07d.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new PrivilegedAccessGroupAssignmentScheduleRequest
{
AccessId = PrivilegedAccessGroupRelationships.Member,
PrincipalId = "3cce9d87-3986-4f19-8335-7ed075408ca2",
GroupId = "2b5ed229-4072-478d-9504-a047ebd4b07d",
Action = ScheduleRequestActions.SelfActivate,
ScheduleInfo = new RequestSchedule
{
StartDateTime = DateTimeOffset.Parse("2023-02-08T07:43:00.000Z"),
Expiration = new ExpirationPattern
{
Type = ExpirationPatternType.AfterDuration,
Duration = TimeSpan.Parse("PT2H"),
},
},
Justification = "Activate assignment.",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.PrivilegedAccess.Group.AssignmentScheduleRequests.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrivilegedAccessGroupAssignmentScheduleRequest privilegedAccessGroupAssignmentScheduleRequest = new PrivilegedAccessGroupAssignmentScheduleRequest();
privilegedAccessGroupAssignmentScheduleRequest.setAccessId(PrivilegedAccessGroupRelationships.Member);
privilegedAccessGroupAssignmentScheduleRequest.setPrincipalId("3cce9d87-3986-4f19-8335-7ed075408ca2");
privilegedAccessGroupAssignmentScheduleRequest.setGroupId("2b5ed229-4072-478d-9504-a047ebd4b07d");
privilegedAccessGroupAssignmentScheduleRequest.setAction(ScheduleRequestActions.SelfActivate);
RequestSchedule scheduleInfo = new RequestSchedule();
OffsetDateTime startDateTime = OffsetDateTime.parse("2023-02-08T07:43:00.000Z");
scheduleInfo.setStartDateTime(startDateTime);
ExpirationPattern expiration = new ExpirationPattern();
expiration.setType(ExpirationPatternType.AfterDuration);
PeriodAndDuration duration = PeriodAndDuration.ofDuration(Duration.parse("PT2H"));
expiration.setDuration(duration);
scheduleInfo.setExpiration(expiration);
privilegedAccessGroupAssignmentScheduleRequest.setScheduleInfo(scheduleInfo);
privilegedAccessGroupAssignmentScheduleRequest.setJustification("Activate assignment.");
PrivilegedAccessGroupAssignmentScheduleRequest result = graphClient.identityGovernance().privilegedAccess().group().assignmentScheduleRequests().post(privilegedAccessGroupAssignmentScheduleRequest);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupAssignmentScheduleRequest;
use Microsoft\Graph\Generated\Models\PrivilegedAccessGroupRelationships;
use Microsoft\Graph\Generated\Models\ScheduleRequestActions;
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 PrivilegedAccessGroupAssignmentScheduleRequest();
$requestBody->setAccessId(new PrivilegedAccessGroupRelationships('member'));
$requestBody->setPrincipalId('3cce9d87-3986-4f19-8335-7ed075408ca2');
$requestBody->setGroupId('2b5ed229-4072-478d-9504-a047ebd4b07d');
$requestBody->setAction(new ScheduleRequestActions('selfActivate'));
$scheduleInfo = new RequestSchedule();
$scheduleInfo->setStartDateTime(new \DateTime('2023-02-08T07:43:00.000Z'));
$scheduleInfoExpiration = new ExpirationPattern();
$scheduleInfoExpiration->setType(new ExpirationPatternType('afterDuration'));
$scheduleInfoExpiration->setDuration(new \DateInterval('PT2H'));
$scheduleInfo->setExpiration($scheduleInfoExpiration);
$requestBody->setScheduleInfo($scheduleInfo);
$requestBody->setJustification('Activate assignment.');
$result = $graphServiceClient->identityGovernance()->privilegedAccess()->group()->assignmentScheduleRequests()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.privileged_access_group_assignment_schedule_request import PrivilegedAccessGroupAssignmentScheduleRequest
from msgraph.generated.models.privileged_access_group_relationships import PrivilegedAccessGroupRelationships
from msgraph.generated.models.schedule_request_actions import ScheduleRequestActions
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 = PrivilegedAccessGroupAssignmentScheduleRequest(
access_id = PrivilegedAccessGroupRelationships.Member,
principal_id = "3cce9d87-3986-4f19-8335-7ed075408ca2",
group_id = "2b5ed229-4072-478d-9504-a047ebd4b07d",
action = ScheduleRequestActions.SelfActivate,
schedule_info = RequestSchedule(
start_date_time = "2023-02-08T07:43:00.000Z",
expiration = ExpirationPattern(
type = ExpirationPatternType.AfterDuration,
duration = "PT2H",
),
),
justification = "Activate assignment.",
)
result = await graph_client.identity_governance.privileged_access.group.assignment_schedule_requests.post(request_body)