Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Dans les scénarios délégués avec des comptes professionnels ou scolaires, l’utilisateur connecté doit également se voir attribuer un rôle d’administrateur avec des autorisations de rôle prises en charge via l’une des options suivantes :
Utilisateur spécifié dans la specificAllowedTargets propriété des stratégies du package d’accès.
Il s’agit de l’option la moins privilégiée.
Des rôles Microsoft Entra plus privilégiés, où les rôles les moins privilégiés suivants sont pris en charge pour cette opération :
Administrateur de gouvernance des identités
Dans les scénarios d’application uniquement, l’application appelante peut se voir attribuer l’un des rôles pris en charge précédents au lieu de l’autorisation d’application EntitlementManagement.ReadWrite.All . Un utilisateur spécifié dans la specificAllowedTargets propriété des stratégies du package d’accès est moins privilégié que l’autorisation d’application EntitlementManagement.ReadWrite.All .
Pour qu’un administrateur demande à créer une affectation pour un utilisateur, la valeur de la propriété requestType est adminAdd, et la propriété assignment contient le targetId de l’utilisateur affecté, la propriété assignmentPolicyId identifiant accessPackageAssignmentPolicy et la propriété accessPackageId identifiant le accessPackage.
Pour qu’un administrateur demande la mise à jour d’une affectation (par exemple pour étendre l’affectation ou mettre à jour les réponses aux questions), la valeur de la propriété requestType est adminUpdate, et la propriété d’affectation contient la propriété id identifiant le accessPackageAssignment en cours de mise à jour.
Pour qu’un administrateur demande la suppression d’une affectation, la valeur de la propriété requestType est adminRemove, et la propriété assignment contient la propriété id identifiant le accessPackageAssignment en cours de suppression.
Pour qu’un utilisateur non administrateur demande à créer son propre affectation pour une première affectation ou une attribution de renouvellement, la valeur de la propriété requestType est userAdd. La propriété assignment contient un objet avec avec targetId le id de l’utilisateur. La propriété assignmentPolicyId identifie accessPackageAssignmentPolicy. La propriété accessPackageId identifie le accessPackage. L’utilisateur qui effectue la demande doit déjà exister dans le répertoire.
Pour qu’un utilisateur non administrateur demande à mettre à jour ses propres affectations, la valeur de la propriété requestType est userUpdate. La propriété assignment contient avec targetId le id des utilisateurs. La propriété assignmentPolicyId identifie accessPackageAssignmentPolicy. La propriété accessPackageId identifie le accessPackage. L’utilisateur qui effectue la demande doit déjà exister dans le répertoire.
Réponse
Si elle réussit, cette méthode renvoie un code de réponse de série 200 et un nouvel objet accessPackageAssignmentRequest dans le corps de la réponse.
Exemple 1 : Administration demande une affectation directe pour un utilisateur déjà dans l’annuaire
Demande
L’exemple suivant montre une demande d’affectation directe, dans laquelle l’administrateur demande la création d’une affectation pour un utilisateur. Étant donné que accessPackageSubject n’existe peut-être pas encore, la valeur de targetID est l’ID d’objet de l’utilisateur affecté, la valeur de l’accessPackageId est le package d’accès souhaité pour cet utilisateur et la valeur de assignmentPolicyId est une stratégie d’affectation directe dans ce package d’accès.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new AccessPackageAssignmentRequest
{
RequestType = "adminAdd",
AdditionalData = new Dictionary<string, object>
{
{
"assignment" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"targetId", new UntypedString("46184453-e63b-4f20-86c2-c557ed5d5df9")
},
{
"assignmentPolicyId", new UntypedString("2264bf65-76ba-417b-a27d-54d291f0cbc8")
},
{
"accessPackageId", new UntypedString("a914b616-e04e-476b-aa37-91038f0b165b")
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setRequestType("adminAdd");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
assignment = new ();
assignment.setTargetId("46184453-e63b-4f20-86c2-c557ed5d5df9");
assignment.setAssignmentPolicyId("2264bf65-76ba-417b-a27d-54d291f0cbc8");
assignment.setAccessPackageId("a914b616-e04e-476b-aa37-91038f0b165b");
additionalData.put("assignment", assignment);
accessPackageAssignmentRequest.setAdditionalData(additionalData);
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.access_package_assignment_request import AccessPackageAssignmentRequest
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessPackageAssignmentRequest(
request_type = "adminAdd",
additional_data = {
"assignment" : {
"target_id" : "46184453-e63b-4f20-86c2-c557ed5d5df9",
"assignment_policy_id" : "2264bf65-76ba-417b-a27d-54d291f0cbc8",
"access_package_id" : "a914b616-e04e-476b-aa37-91038f0b165b",
},
}
)
result = await graph_client.identity_governance.entitlement_management.assignment_requests.post(request_body)
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new AccessPackageAssignmentRequest
{
RequestType = "adminRemove",
AdditionalData = new Dictionary<string, object>
{
{
"assignment" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("a6bb6942-3ae1-4259-9908-0133aaee9377")
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// 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.NewAccessPackageAssignmentRequest()
requestType := "adminRemove"
requestBody.SetRequestType(&requestType)
additionalData := map[string]interface{}{
assignment := graph.New()
id := "a6bb6942-3ae1-4259-9908-0133aaee9377"
assignment.SetId(&id)
requestBody.SetAssignment(assignment)
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignmentRequests, err := graphClient.IdentityGovernance().EntitlementManagement().AssignmentRequests().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setRequestType("adminRemove");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
assignment = new ();
assignment.setId("a6bb6942-3ae1-4259-9908-0133aaee9377");
additionalData.put("assignment", assignment);
accessPackageAssignmentRequest.setAdditionalData(additionalData);
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.access_package_assignment_request import AccessPackageAssignmentRequest
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessPackageAssignmentRequest(
request_type = "adminRemove",
additional_data = {
"assignment" : {
"id" : "a6bb6942-3ae1-4259-9908-0133aaee9377",
},
}
)
result = await graph_client.identity_governance.entitlement_management.assignment_requests.post(request_body)
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité. Toutes les propriétés sont retournées à partir d’un appel réel.
Exemple 3 : Demander un devoir en fournissant des réponses aux questions
L’exemple suivant montre comment un utilisateur peut demander une attribution de package d’accès pour lui-même en répondant aux questions requises par la stratégie pendant le processus de demande.
POST https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/assignmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.accessPackageAssignmentRequest",
"requestType": "userAdd",
"answers": [
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"displayValue": "This is the answer to a multiple choice question",
"value": "MultipleChoiceAnswerValue",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageMultipleChoiceQuestion",
"id": "8fe745e7-80b2-490d-bd22-4e708c77288c"
}
},
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"value": "This is my answer to a text input question.",
"displayValue": "This is my answer.",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",
"id": "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6"
}
}
],
"assignment": {
"accessPackageId": "977c7ff4-ef8f-4910-9d31-49048ddf3120"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new AccessPackageAssignmentRequest
{
OdataType = "#microsoft.graph.accessPackageAssignmentRequest",
RequestType = "userAdd",
Answers = new List<AccessPackageAnswer>
{
new AccessPackageAnswerString
{
OdataType = "#microsoft.graph.accessPackageAnswerString",
DisplayValue = "This is the answer to a multiple choice question",
Value = "MultipleChoiceAnswerValue",
AnsweredQuestion = new AccessPackageMultipleChoiceQuestion
{
OdataType = "#microsoft.graph.accessPackageMultipleChoiceQuestion",
Id = "8fe745e7-80b2-490d-bd22-4e708c77288c",
},
},
new AccessPackageAnswerString
{
OdataType = "#microsoft.graph.accessPackageAnswerString",
Value = "This is my answer to a text input question.",
DisplayValue = "This is my answer.",
AnsweredQuestion = new AccessPackageTextInputQuestion
{
OdataType = "#microsoft.graph.accessPackageTextInputQuestion",
Id = "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6",
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"assignment" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"accessPackageId", new UntypedString("977c7ff4-ef8f-4910-9d31-49048ddf3120")
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// 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.NewAccessPackageAssignmentRequest()
requestType := "userAdd"
requestBody.SetRequestType(&requestType)
accessPackageAnswer := graphmodels.NewAccessPackageAnswerString()
displayValue := "This is the answer to a multiple choice question"
accessPackageAnswer.SetDisplayValue(&displayValue)
value := "MultipleChoiceAnswerValue"
accessPackageAnswer.SetValue(&value)
answeredQuestion := graphmodels.NewAccessPackageMultipleChoiceQuestion()
id := "8fe745e7-80b2-490d-bd22-4e708c77288c"
answeredQuestion.SetId(&id)
accessPackageAnswer.SetAnsweredQuestion(answeredQuestion)
accessPackageAnswer1 := graphmodels.NewAccessPackageAnswerString()
value := "This is my answer to a text input question."
accessPackageAnswer1.SetValue(&value)
displayValue := "This is my answer."
accessPackageAnswer1.SetDisplayValue(&displayValue)
answeredQuestion := graphmodels.NewAccessPackageTextInputQuestion()
id := "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6"
answeredQuestion.SetId(&id)
accessPackageAnswer1.SetAnsweredQuestion(answeredQuestion)
answers := []graphmodels.AccessPackageAnswerable {
accessPackageAnswer,
accessPackageAnswer1,
}
requestBody.SetAnswers(answers)
additionalData := map[string]interface{}{
assignment := graph.New()
accessPackageId := "977c7ff4-ef8f-4910-9d31-49048ddf3120"
assignment.SetAccessPackageId(&accessPackageId)
requestBody.SetAssignment(assignment)
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignmentRequests, err := graphClient.IdentityGovernance().EntitlementManagement().AssignmentRequests().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setOdataType("#microsoft.graph.accessPackageAssignmentRequest");
accessPackageAssignmentRequest.setRequestType("userAdd");
LinkedList<AccessPackageAnswer> answers = new LinkedList<AccessPackageAnswer>();
AccessPackageAnswerString accessPackageAnswer = new AccessPackageAnswerString();
accessPackageAnswer.setOdataType("#microsoft.graph.accessPackageAnswerString");
accessPackageAnswer.setDisplayValue("This is the answer to a multiple choice question");
accessPackageAnswer.setValue("MultipleChoiceAnswerValue");
AccessPackageMultipleChoiceQuestion answeredQuestion = new AccessPackageMultipleChoiceQuestion();
answeredQuestion.setOdataType("#microsoft.graph.accessPackageMultipleChoiceQuestion");
answeredQuestion.setId("8fe745e7-80b2-490d-bd22-4e708c77288c");
accessPackageAnswer.setAnsweredQuestion(answeredQuestion);
answers.add(accessPackageAnswer);
AccessPackageAnswerString accessPackageAnswer1 = new AccessPackageAnswerString();
accessPackageAnswer1.setOdataType("#microsoft.graph.accessPackageAnswerString");
accessPackageAnswer1.setValue("This is my answer to a text input question.");
accessPackageAnswer1.setDisplayValue("This is my answer.");
AccessPackageTextInputQuestion answeredQuestion1 = new AccessPackageTextInputQuestion();
answeredQuestion1.setOdataType("#microsoft.graph.accessPackageTextInputQuestion");
answeredQuestion1.setId("7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6");
accessPackageAnswer1.setAnsweredQuestion(answeredQuestion1);
answers.add(accessPackageAnswer1);
accessPackageAssignmentRequest.setAnswers(answers);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
assignment = new ();
assignment.setAccessPackageId("977c7ff4-ef8f-4910-9d31-49048ddf3120");
additionalData.put("assignment", assignment);
accessPackageAssignmentRequest.setAdditionalData(additionalData);
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageAssignmentRequest;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageAnswer;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageAnswerString;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageMultipleChoiceQuestion;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageTextInputQuestion;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageAssignmentRequest();
$requestBody->setOdataType('#microsoft.graph.accessPackageAssignmentRequest');
$requestBody->setRequestType('userAdd');
$answersAccessPackageAnswer1 = new AccessPackageAnswerString();
$answersAccessPackageAnswer1->setOdataType('#microsoft.graph.accessPackageAnswerString');
$answersAccessPackageAnswer1->setDisplayValue('This is the answer to a multiple choice question');
$answersAccessPackageAnswer1->setValue('MultipleChoiceAnswerValue');
$answersAccessPackageAnswer1AnsweredQuestion = new AccessPackageMultipleChoiceQuestion();
$answersAccessPackageAnswer1AnsweredQuestion->setOdataType('#microsoft.graph.accessPackageMultipleChoiceQuestion');
$answersAccessPackageAnswer1AnsweredQuestion->setId('8fe745e7-80b2-490d-bd22-4e708c77288c');
$answersAccessPackageAnswer1->setAnsweredQuestion($answersAccessPackageAnswer1AnsweredQuestion);
$answersArray []= $answersAccessPackageAnswer1;
$answersAccessPackageAnswer2 = new AccessPackageAnswerString();
$answersAccessPackageAnswer2->setOdataType('#microsoft.graph.accessPackageAnswerString');
$answersAccessPackageAnswer2->setValue('This is my answer to a text input question.');
$answersAccessPackageAnswer2->setDisplayValue('This is my answer.');
$answersAccessPackageAnswer2AnsweredQuestion = new AccessPackageTextInputQuestion();
$answersAccessPackageAnswer2AnsweredQuestion->setOdataType('#microsoft.graph.accessPackageTextInputQuestion');
$answersAccessPackageAnswer2AnsweredQuestion->setId('7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6');
$answersAccessPackageAnswer2->setAnsweredQuestion($answersAccessPackageAnswer2AnsweredQuestion);
$answersArray []= $answersAccessPackageAnswer2;
$requestBody->setAnswers($answersArray);
$additionalData = [
'assignment' => [
'accessPackageId' => '977c7ff4-ef8f-4910-9d31-49048ddf3120',
],
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->assignmentRequests()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.access_package_assignment_request import AccessPackageAssignmentRequest
from msgraph_beta.generated.models.access_package_answer import AccessPackageAnswer
from msgraph_beta.generated.models.access_package_answer_string import AccessPackageAnswerString
from msgraph_beta.generated.models.access_package_multiple_choice_question import AccessPackageMultipleChoiceQuestion
from msgraph_beta.generated.models.access_package_text_input_question import AccessPackageTextInputQuestion
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessPackageAssignmentRequest(
odata_type = "#microsoft.graph.accessPackageAssignmentRequest",
request_type = "userAdd",
answers = [
AccessPackageAnswerString(
odata_type = "#microsoft.graph.accessPackageAnswerString",
display_value = "This is the answer to a multiple choice question",
value = "MultipleChoiceAnswerValue",
answered_question = AccessPackageMultipleChoiceQuestion(
odata_type = "#microsoft.graph.accessPackageMultipleChoiceQuestion",
id = "8fe745e7-80b2-490d-bd22-4e708c77288c",
),
),
AccessPackageAnswerString(
odata_type = "#microsoft.graph.accessPackageAnswerString",
value = "This is my answer to a text input question.",
display_value = "This is my answer.",
answered_question = AccessPackageTextInputQuestion(
odata_type = "#microsoft.graph.accessPackageTextInputQuestion",
id = "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6",
),
),
],
additional_data = {
"assignment" : {
"access_package_id" : "977c7ff4-ef8f-4910-9d31-49048ddf3120",
},
}
)
result = await graph_client.identity_governance.entitlement_management.assignment_requests.post(request_body)
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité. Toutes les propriétés sont retournées à partir d’un appel réel.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#accessPackageAssignmentRequests/$entity",
"id": "7a6ab703-0780-4b37-8445-81f679b2d75c",
"requestType": "userAdd",
"state": "submitted",
"status": "Accepted",
"createdDateTime": null,
"completedDateTime": null,
"schedule": {
"startDateTime": null,
"recurrence": null,
"expiration": {
"endDateTime": null,
"duration": null,
"type": "notSpecified"
}
},
"answers": [
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"value": "MultipleChoiceAnswerValue",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageMultipleChoiceQuestion",
"id": "8fe745e7-80b2-490d-bd22-4e708c77288c"
},
"displayValue": "This is the answer to a multiple choice question"
},
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"value": "This is my answer to a text input question.",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",
"id": "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6"
},
"displayValue": "This is my answer."
}
]
}
Exemple 4 : Demander un package et fournir une justification
L’exemple suivant montre comment demander un package d’accès et fournir une justification à l’approbateur.
POST https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/assignmentRequests
Content-type: application/json
{
"requestType": "UserAdd",
"accessPackageAssignment": {
"accessPackageId": "a914b616-e04e-476b-aa37-91038f0b165b"
},
"justification":"Need access to New Hire access package"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new AccessPackageAssignmentRequest
{
RequestType = "UserAdd",
AccessPackageAssignment = new AccessPackageAssignment
{
AccessPackageId = "a914b616-e04e-476b-aa37-91038f0b165b",
},
Justification = "Need access to New Hire access package",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// 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.NewAccessPackageAssignmentRequest()
requestType := "UserAdd"
requestBody.SetRequestType(&requestType)
accessPackageAssignment := graphmodels.NewAccessPackageAssignment()
accessPackageId := "a914b616-e04e-476b-aa37-91038f0b165b"
accessPackageAssignment.SetAccessPackageId(&accessPackageId)
requestBody.SetAccessPackageAssignment(accessPackageAssignment)
justification := "Need access to New Hire access package"
requestBody.SetJustification(&justification)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignmentRequests, err := graphClient.IdentityGovernance().EntitlementManagement().AssignmentRequests().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setRequestType("UserAdd");
AccessPackageAssignment accessPackageAssignment = new AccessPackageAssignment();
accessPackageAssignment.setAccessPackageId("a914b616-e04e-476b-aa37-91038f0b165b");
accessPackageAssignmentRequest.setAccessPackageAssignment(accessPackageAssignment);
accessPackageAssignmentRequest.setJustification("Need access to New Hire access package");
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageAssignmentRequest;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageAssignment;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageAssignmentRequest();
$requestBody->setRequestType('UserAdd');
$accessPackageAssignment = new AccessPackageAssignment();
$accessPackageAssignment->setAccessPackageId('a914b616-e04e-476b-aa37-91038f0b165b');
$requestBody->setAccessPackageAssignment($accessPackageAssignment);
$requestBody->setJustification('Need access to New Hire access package');
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->assignmentRequests()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.access_package_assignment_request import AccessPackageAssignmentRequest
from msgraph_beta.generated.models.access_package_assignment import AccessPackageAssignment
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessPackageAssignmentRequest(
request_type = "UserAdd",
access_package_assignment = AccessPackageAssignment(
access_package_id = "a914b616-e04e-476b-aa37-91038f0b165b",
),
justification = "Need access to New Hire access package",
)
result = await graph_client.identity_governance.entitlement_management.assignment_requests.post(request_body)
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité. Toutes les propriétés sont retournées à partir d’un appel réel.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new AccessPackageAssignmentRequest
{
Justification = "Access for direct employee",
RequestType = "UserAdd",
Answers = new List<AccessPackageAnswer>
{
},
AdditionalData = new Dictionary<string, object>
{
{
"assignment" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"accessPackageId", new UntypedString("5b98f958-0dea-4a5b-836e-109dccbd530c")
},
{
"schedule", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"startDateTime", new UntypedNull()
},
{
"stopDateTime", new UntypedNull()
},
})
},
{
"assignmentPolicyId", new UntypedString("c5f7847f-83a8-4315-a754-d94a6f39b875")
},
{
"target", new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"displayName", new UntypedString("Idris Ibrahim")
},
{
"email", new UntypedString("IdrisIbrahim@woodgrovebank.com")
},
{
"objectId", new UntypedString("21aceaba-fe13-4e3b-aa8c-4c588d5e7387")
},
{
"subjectType", new UntypedString("user")
},
})
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setJustification("Access for direct employee");
accessPackageAssignmentRequest.setRequestType("UserAdd");
LinkedList<AccessPackageAnswer> answers = new LinkedList<AccessPackageAnswer>();
accessPackageAssignmentRequest.setAnswers(answers);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
assignment = new ();
assignment.setAccessPackageId("5b98f958-0dea-4a5b-836e-109dccbd530c");
schedule = new ();
schedule.setStartDateTime(null);
schedule.setStopDateTime(null);
assignment.setSchedule(schedule);
assignment.setAssignmentPolicyId("c5f7847f-83a8-4315-a754-d94a6f39b875");
target = new ();
target.setDisplayName("Idris Ibrahim");
target.setEmail("IdrisIbrahim@woodgrovebank.com");
target.setObjectId("21aceaba-fe13-4e3b-aa8c-4c588d5e7387");
target.setSubjectType("user");
assignment.setTarget(target);
additionalData.put("assignment", assignment);
accessPackageAssignmentRequest.setAdditionalData(additionalData);
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité. Toutes les propriétés sont retournées à partir d’un appel réel.
Exemple 6 : Administration demande une affectation directe pour un utilisateur qui n’est pas encore dans l’annuaire
Demande
L’exemple suivant montre une demande d’affectation directe, dans laquelle l’administrateur demande la création d’une affectation pour un utilisateur qui n’existe pas dans l’annuaire. La valeur de accessPackageId est le package d’accès souhaité pour cet utilisateur, et la valeur de assignmentPolicyId est une stratégie d’affectation directe dans ce package d’accès.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new AccessPackageAssignmentRequest
{
RequestType = "AdminAdd",
AccessPackageAssignment = new AccessPackageAssignment
{
Target = new AccessPackageSubject
{
Email = "user@contoso.com",
},
AssignmentPolicyId = "2264bf65-76ba-417b-a27d-54d291f0cbc8",
AccessPackageId = "a914b616-e04e-476b-aa37-91038f0b165b",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setRequestType("AdminAdd");
AccessPackageAssignment accessPackageAssignment = new AccessPackageAssignment();
AccessPackageSubject target = new AccessPackageSubject();
target.setEmail("user@contoso.com");
accessPackageAssignment.setTarget(target);
accessPackageAssignment.setAssignmentPolicyId("2264bf65-76ba-417b-a27d-54d291f0cbc8");
accessPackageAssignment.setAccessPackageId("a914b616-e04e-476b-aa37-91038f0b165b");
accessPackageAssignmentRequest.setAccessPackageAssignment(accessPackageAssignment);
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageAssignmentRequest;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageAssignment;
use Microsoft\Graph\Beta\Generated\Models\AccessPackageSubject;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessPackageAssignmentRequest();
$requestBody->setRequestType('AdminAdd');
$accessPackageAssignment = new AccessPackageAssignment();
$accessPackageAssignmentTarget = new AccessPackageSubject();
$accessPackageAssignmentTarget->setEmail('user@contoso.com');
$accessPackageAssignment->setTarget($accessPackageAssignmentTarget);
$accessPackageAssignment->setAssignmentPolicyId('2264bf65-76ba-417b-a27d-54d291f0cbc8');
$accessPackageAssignment->setAccessPackageId('a914b616-e04e-476b-aa37-91038f0b165b');
$requestBody->setAccessPackageAssignment($accessPackageAssignment);
$result = $graphServiceClient->identityGovernance()->entitlementManagement()->assignmentRequests()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.access_package_assignment_request import AccessPackageAssignmentRequest
from msgraph_beta.generated.models.access_package_assignment import AccessPackageAssignment
from msgraph_beta.generated.models.access_package_subject import AccessPackageSubject
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessPackageAssignmentRequest(
request_type = "AdminAdd",
access_package_assignment = AccessPackageAssignment(
target = AccessPackageSubject(
email = "user@contoso.com",
),
assignment_policy_id = "2264bf65-76ba-417b-a27d-54d291f0cbc8",
access_package_id = "a914b616-e04e-476b-aa37-91038f0b165b",
),
)
result = await graph_client.identity_governance.entitlement_management.assignment_requests.post(request_body)
Exemple 7 : Demander une mise à jour des réponses pour un devoir
L’exemple suivant montre comment un administrateur peut demander des mises à jour d’un devoir pour modifier ses réponses aux questions auxquelles il a répondu lors de la demande d’affectation.
POST https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/assignmentRequests
Content-type: application/json
{
"@odata.type": "#microsoft.graph.accessPackageAssignmentRequest",
"id": "7a6ab703-0780-4b37-8445-81f679b2d75c",
"requestType": "adminUpdate",
"answers": [
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"value": "UpdatedAnswerValue",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageMultipleChoiceQuestion",
"id": "8fe745e7-80b2-490d-bd22-4e708c77288c"
}
},
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"value": "My updated answer.",
"displayValue": "This is my updated answer to the question.",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",
"id": "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6"
}
}
],
"assignment": {
"id": "44c741c1-2cf4-40db-83b6-e0112f8e5a83"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new AccessPackageAssignmentRequest
{
OdataType = "#microsoft.graph.accessPackageAssignmentRequest",
Id = "7a6ab703-0780-4b37-8445-81f679b2d75c",
RequestType = "adminUpdate",
Answers = new List<AccessPackageAnswer>
{
new AccessPackageAnswerString
{
OdataType = "#microsoft.graph.accessPackageAnswerString",
Value = "UpdatedAnswerValue",
AnsweredQuestion = new AccessPackageMultipleChoiceQuestion
{
OdataType = "#microsoft.graph.accessPackageMultipleChoiceQuestion",
Id = "8fe745e7-80b2-490d-bd22-4e708c77288c",
},
},
new AccessPackageAnswerString
{
OdataType = "#microsoft.graph.accessPackageAnswerString",
Value = "My updated answer.",
DisplayValue = "This is my updated answer to the question.",
AnsweredQuestion = new AccessPackageTextInputQuestion
{
OdataType = "#microsoft.graph.accessPackageTextInputQuestion",
Id = "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6",
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"assignment" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("44c741c1-2cf4-40db-83b6-e0112f8e5a83")
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// 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.NewAccessPackageAssignmentRequest()
id := "7a6ab703-0780-4b37-8445-81f679b2d75c"
requestBody.SetId(&id)
requestType := "adminUpdate"
requestBody.SetRequestType(&requestType)
accessPackageAnswer := graphmodels.NewAccessPackageAnswerString()
value := "UpdatedAnswerValue"
accessPackageAnswer.SetValue(&value)
answeredQuestion := graphmodels.NewAccessPackageMultipleChoiceQuestion()
id := "8fe745e7-80b2-490d-bd22-4e708c77288c"
answeredQuestion.SetId(&id)
accessPackageAnswer.SetAnsweredQuestion(answeredQuestion)
accessPackageAnswer1 := graphmodels.NewAccessPackageAnswerString()
value := "My updated answer."
accessPackageAnswer1.SetValue(&value)
displayValue := "This is my updated answer to the question."
accessPackageAnswer1.SetDisplayValue(&displayValue)
answeredQuestion := graphmodels.NewAccessPackageTextInputQuestion()
id := "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6"
answeredQuestion.SetId(&id)
accessPackageAnswer1.SetAnsweredQuestion(answeredQuestion)
answers := []graphmodels.AccessPackageAnswerable {
accessPackageAnswer,
accessPackageAnswer1,
}
requestBody.SetAnswers(answers)
additionalData := map[string]interface{}{
assignment := graph.New()
id := "44c741c1-2cf4-40db-83b6-e0112f8e5a83"
assignment.SetId(&id)
requestBody.SetAssignment(assignment)
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
assignmentRequests, err := graphClient.IdentityGovernance().EntitlementManagement().AssignmentRequests().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setOdataType("#microsoft.graph.accessPackageAssignmentRequest");
accessPackageAssignmentRequest.setId("7a6ab703-0780-4b37-8445-81f679b2d75c");
accessPackageAssignmentRequest.setRequestType("adminUpdate");
LinkedList<AccessPackageAnswer> answers = new LinkedList<AccessPackageAnswer>();
AccessPackageAnswerString accessPackageAnswer = new AccessPackageAnswerString();
accessPackageAnswer.setOdataType("#microsoft.graph.accessPackageAnswerString");
accessPackageAnswer.setValue("UpdatedAnswerValue");
AccessPackageMultipleChoiceQuestion answeredQuestion = new AccessPackageMultipleChoiceQuestion();
answeredQuestion.setOdataType("#microsoft.graph.accessPackageMultipleChoiceQuestion");
answeredQuestion.setId("8fe745e7-80b2-490d-bd22-4e708c77288c");
accessPackageAnswer.setAnsweredQuestion(answeredQuestion);
answers.add(accessPackageAnswer);
AccessPackageAnswerString accessPackageAnswer1 = new AccessPackageAnswerString();
accessPackageAnswer1.setOdataType("#microsoft.graph.accessPackageAnswerString");
accessPackageAnswer1.setValue("My updated answer.");
accessPackageAnswer1.setDisplayValue("This is my updated answer to the question.");
AccessPackageTextInputQuestion answeredQuestion1 = new AccessPackageTextInputQuestion();
answeredQuestion1.setOdataType("#microsoft.graph.accessPackageTextInputQuestion");
answeredQuestion1.setId("7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6");
accessPackageAnswer1.setAnsweredQuestion(answeredQuestion1);
answers.add(accessPackageAnswer1);
accessPackageAssignmentRequest.setAnswers(answers);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
assignment = new ();
assignment.setId("44c741c1-2cf4-40db-83b6-e0112f8e5a83");
additionalData.put("assignment", assignment);
accessPackageAssignmentRequest.setAdditionalData(additionalData);
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.access_package_assignment_request import AccessPackageAssignmentRequest
from msgraph_beta.generated.models.access_package_answer import AccessPackageAnswer
from msgraph_beta.generated.models.access_package_answer_string import AccessPackageAnswerString
from msgraph_beta.generated.models.access_package_multiple_choice_question import AccessPackageMultipleChoiceQuestion
from msgraph_beta.generated.models.access_package_text_input_question import AccessPackageTextInputQuestion
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessPackageAssignmentRequest(
odata_type = "#microsoft.graph.accessPackageAssignmentRequest",
id = "7a6ab703-0780-4b37-8445-81f679b2d75c",
request_type = "adminUpdate",
answers = [
AccessPackageAnswerString(
odata_type = "#microsoft.graph.accessPackageAnswerString",
value = "UpdatedAnswerValue",
answered_question = AccessPackageMultipleChoiceQuestion(
odata_type = "#microsoft.graph.accessPackageMultipleChoiceQuestion",
id = "8fe745e7-80b2-490d-bd22-4e708c77288c",
),
),
AccessPackageAnswerString(
odata_type = "#microsoft.graph.accessPackageAnswerString",
value = "My updated answer.",
display_value = "This is my updated answer to the question.",
answered_question = AccessPackageTextInputQuestion(
odata_type = "#microsoft.graph.accessPackageTextInputQuestion",
id = "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6",
),
),
],
additional_data = {
"assignment" : {
"id" : "44c741c1-2cf4-40db-83b6-e0112f8e5a83",
},
}
)
result = await graph_client.identity_governance.entitlement_management.assignment_requests.post(request_body)
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité. Toutes les propriétés sont retournées à partir d’un appel réel.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#accessPackageAssignmentRequests/$entity",
"id": "0c471116-e439-40a6-8441-fe739dd48dab",
"requestType": "adminUpdate",
"state": "submitted",
"status": "Accepted",
"createdDateTime": null,
"completedDateTime": null,
"schedule": {
"startDateTime": null,
"recurrence": null,
"expiration": {
"endDateTime": null,
"duration": null,
"type": "notSpecified"
}
},
"answers": [
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"value": "UpdatedAnswerValue",
"displayValue": "This is the answer to a multiple choice question",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageMultipleChoiceQuestion",
"id": "8fe745e7-80b2-490d-bd22-4e708c77288c"
}
},
{
"@odata.type": "#microsoft.graph.accessPackageAnswerString",
"value": "My updated answer.",
"displayValue": "This is my updated answer to the question.",
"answeredQuestion": {
"@odata.type": "#microsoft.graph.accessPackageTextInputQuestion",
"id": "7aaa18c9-8e4f-440f-bd5a-3a7ce312cbe6"
}
}
]
}
Exemple 8 : Mettre à jour la date d’expiration d’une attribution de package d’accès
L’exemple suivant montre comment mettre à jour la date d’expiration d’une attribution de package d’accès.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
using Microsoft.Kiota.Abstractions.Serialization;
var requestBody = new AccessPackageAssignmentRequest
{
OdataType = "#microsoft.graph.accessPackageAssignmentRequest",
RequestType = "adminUpdate",
Schedule = new RequestSchedule
{
StartDateTime = DateTimeOffset.Parse("2023-05-23T20:04:02.39Z"),
Recurrence = null,
Expiration = new ExpirationPattern
{
EndDateTime = DateTimeOffset.Parse("2024-07-01T00:00:00.00Z"),
Duration = null,
Type = ExpirationPatternType.AfterDateTime,
},
},
AdditionalData = new Dictionary<string, object>
{
{
"assignment" , new UntypedObject(new Dictionary<string, UntypedNode>
{
{
"id", new UntypedString("329f8dac-8062-4c1b-a9b8-39b7132f9bff")
},
})
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.IdentityGovernance.EntitlementManagement.AssignmentRequests.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessPackageAssignmentRequest accessPackageAssignmentRequest = new AccessPackageAssignmentRequest();
accessPackageAssignmentRequest.setOdataType("#microsoft.graph.accessPackageAssignmentRequest");
accessPackageAssignmentRequest.setRequestType("adminUpdate");
RequestSchedule schedule = new RequestSchedule();
OffsetDateTime startDateTime = OffsetDateTime.parse("2023-05-23T20:04:02.39Z");
schedule.setStartDateTime(startDateTime);
schedule.setRecurrence(null);
ExpirationPattern expiration = new ExpirationPattern();
OffsetDateTime endDateTime = OffsetDateTime.parse("2024-07-01T00:00:00.00Z");
expiration.setEndDateTime(endDateTime);
expiration.setDuration(null);
expiration.setType(ExpirationPatternType.AfterDateTime);
schedule.setExpiration(expiration);
accessPackageAssignmentRequest.setSchedule(schedule);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
assignment = new ();
assignment.setId("329f8dac-8062-4c1b-a9b8-39b7132f9bff");
additionalData.put("assignment", assignment);
accessPackageAssignmentRequest.setAdditionalData(additionalData);
AccessPackageAssignmentRequest result = graphClient.identityGovernance().entitlementManagement().assignmentRequests().post(accessPackageAssignmentRequest);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.access_package_assignment_request import AccessPackageAssignmentRequest
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 = AccessPackageAssignmentRequest(
odata_type = "#microsoft.graph.accessPackageAssignmentRequest",
request_type = "adminUpdate",
schedule = RequestSchedule(
start_date_time = "2023-05-23T20:04:02.39Z",
recurrence = None,
expiration = ExpirationPattern(
end_date_time = "2024-07-01T00:00:00.00Z",
duration = None,
type = ExpirationPatternType.AfterDateTime,
),
),
additional_data = {
"assignment" : {
"id" : "329f8dac-8062-4c1b-a9b8-39b7132f9bff",
},
}
)
result = await graph_client.identity_governance.entitlement_management.assignment_requests.post(request_body)
Remarque : l’objet de réponse affiché ci-après peut être raccourci pour plus de lisibilité. Toutes les propriétés sont retournées à partir d’un appel réel.