POST https://graph.microsoft.com/beta/accessReviews
Content-type: application/json
{
"displayName":"TestReview",
"startDateTime":"2017-02-10T00:35:53.214Z",
"endDateTime":"2017-03-12T00:35:53.214Z",
"reviewedEntity": {
"id": "99025615-a0b1-47ec-9117-35377b10998b"
},
"reviewerType" : "delegated",
"businessFlowTemplateId": "6e4f3d20-c5c3-407f-9695-8460952bcc68",
"description":"Sample description",
"reviewers":
[
{
"id":"f260246a-09b1-4fd5-8d18-daed736071ec"
},
{
"id":"5a4e184c-4ee5-4883-96e9-b371f8da88e3"
}
],
"settings":
{
"mailNotificationsEnabled": true,
"remindersEnabled": true,
"justificationRequiredOnApproval":true,
"autoReviewEnabled":false,
"activityDurationInDays":30,
"autoApplyReviewResultsEnabled":false,
"accessRecommendationsEnabled":false,
"recurrenceSettings":{
"recurrenceType":"onetime",
"recurrenceEndType":"endBy",
"durationInDays":0,
"recurrenceCount":0
},
"autoReviewSettings":{
"notReviewedResult":"Deny"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new AccessReview
{
DisplayName = "TestReview",
StartDateTime = DateTimeOffset.Parse("2017-02-10T00:35:53.214Z"),
EndDateTime = DateTimeOffset.Parse("2017-03-12T00:35:53.214Z"),
ReviewedEntity = new Identity
{
Id = "99025615-a0b1-47ec-9117-35377b10998b",
},
ReviewerType = "delegated",
BusinessFlowTemplateId = "6e4f3d20-c5c3-407f-9695-8460952bcc68",
Description = "Sample description",
Reviewers = new List<AccessReviewReviewer>
{
new AccessReviewReviewer
{
Id = "f260246a-09b1-4fd5-8d18-daed736071ec",
},
new AccessReviewReviewer
{
Id = "5a4e184c-4ee5-4883-96e9-b371f8da88e3",
},
},
Settings = new AccessReviewSettings
{
MailNotificationsEnabled = true,
RemindersEnabled = true,
JustificationRequiredOnApproval = true,
AutoReviewEnabled = false,
ActivityDurationInDays = 30,
AutoApplyReviewResultsEnabled = false,
AccessRecommendationsEnabled = false,
RecurrenceSettings = new AccessReviewRecurrenceSettings
{
RecurrenceType = "onetime",
RecurrenceEndType = "endBy",
DurationInDays = 0,
RecurrenceCount = 0,
},
AutoReviewSettings = new AutoReviewSettings
{
NotReviewedResult = "Deny",
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.AccessReviews.PostAsync(requestBody);
mgc-beta access-reviews create --body '{\
"displayName":"TestReview",\
"startDateTime":"2017-02-10T00:35:53.214Z",\
"endDateTime":"2017-03-12T00:35:53.214Z",\
"reviewedEntity": {\
"id": "99025615-a0b1-47ec-9117-35377b10998b"\
},\
"reviewerType" : "delegated",\
"businessFlowTemplateId": "6e4f3d20-c5c3-407f-9695-8460952bcc68",\
"description":"Sample description",\
"reviewers":\
[\
{\
"id":"f260246a-09b1-4fd5-8d18-daed736071ec"\
},\
{\
"id":"5a4e184c-4ee5-4883-96e9-b371f8da88e3"\
}\
],\
"settings":\
{\
"mailNotificationsEnabled": true,\
"remindersEnabled": true,\
"justificationRequiredOnApproval":true,\
"autoReviewEnabled":false,\
"activityDurationInDays":30,\
"autoApplyReviewResultsEnabled":false,\
"accessRecommendationsEnabled":false,\
"recurrenceSettings":{\
"recurrenceType":"onetime",\
"recurrenceEndType":"endBy",\
"durationInDays":0,\
"recurrenceCount":0\
},\
"autoReviewSettings":{\
"notReviewedResult":"Deny"\
}\
}\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAccessReview()
displayName := "TestReview"
requestBody.SetDisplayName(&displayName)
startDateTime , err := time.Parse(time.RFC3339, "2017-02-10T00:35:53.214Z")
requestBody.SetStartDateTime(&startDateTime)
endDateTime , err := time.Parse(time.RFC3339, "2017-03-12T00:35:53.214Z")
requestBody.SetEndDateTime(&endDateTime)
reviewedEntity := graphmodels.NewIdentity()
id := "99025615-a0b1-47ec-9117-35377b10998b"
reviewedEntity.SetId(&id)
requestBody.SetReviewedEntity(reviewedEntity)
reviewerType := "delegated"
requestBody.SetReviewerType(&reviewerType)
businessFlowTemplateId := "6e4f3d20-c5c3-407f-9695-8460952bcc68"
requestBody.SetBusinessFlowTemplateId(&businessFlowTemplateId)
description := "Sample description"
requestBody.SetDescription(&description)
accessReviewReviewer := graphmodels.NewAccessReviewReviewer()
id := "f260246a-09b1-4fd5-8d18-daed736071ec"
accessReviewReviewer.SetId(&id)
accessReviewReviewer1 := graphmodels.NewAccessReviewReviewer()
id := "5a4e184c-4ee5-4883-96e9-b371f8da88e3"
accessReviewReviewer1.SetId(&id)
reviewers := []graphmodels.AccessReviewReviewerable {
accessReviewReviewer,
accessReviewReviewer1,
}
requestBody.SetReviewers(reviewers)
settings := graphmodels.NewAccessReviewSettings()
mailNotificationsEnabled := true
settings.SetMailNotificationsEnabled(&mailNotificationsEnabled)
remindersEnabled := true
settings.SetRemindersEnabled(&remindersEnabled)
justificationRequiredOnApproval := true
settings.SetJustificationRequiredOnApproval(&justificationRequiredOnApproval)
autoReviewEnabled := false
settings.SetAutoReviewEnabled(&autoReviewEnabled)
activityDurationInDays := int32(30)
settings.SetActivityDurationInDays(&activityDurationInDays)
autoApplyReviewResultsEnabled := false
settings.SetAutoApplyReviewResultsEnabled(&autoApplyReviewResultsEnabled)
accessRecommendationsEnabled := false
settings.SetAccessRecommendationsEnabled(&accessRecommendationsEnabled)
recurrenceSettings := graphmodels.NewAccessReviewRecurrenceSettings()
recurrenceType := "onetime"
recurrenceSettings.SetRecurrenceType(&recurrenceType)
recurrenceEndType := "endBy"
recurrenceSettings.SetRecurrenceEndType(&recurrenceEndType)
durationInDays := int32(0)
recurrenceSettings.SetDurationInDays(&durationInDays)
recurrenceCount := int32(0)
recurrenceSettings.SetRecurrenceCount(&recurrenceCount)
settings.SetRecurrenceSettings(recurrenceSettings)
autoReviewSettings := graphmodels.NewAutoReviewSettings()
notReviewedResult := "Deny"
autoReviewSettings.SetNotReviewedResult(¬ReviewedResult)
settings.SetAutoReviewSettings(autoReviewSettings)
requestBody.SetSettings(settings)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
accessReviews, err := graphClient.AccessReviews().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AccessReview accessReview = new AccessReview();
accessReview.setDisplayName("TestReview");
OffsetDateTime startDateTime = OffsetDateTime.parse("2017-02-10T00:35:53.214Z");
accessReview.setStartDateTime(startDateTime);
OffsetDateTime endDateTime = OffsetDateTime.parse("2017-03-12T00:35:53.214Z");
accessReview.setEndDateTime(endDateTime);
Identity reviewedEntity = new Identity();
reviewedEntity.setId("99025615-a0b1-47ec-9117-35377b10998b");
accessReview.setReviewedEntity(reviewedEntity);
accessReview.setReviewerType("delegated");
accessReview.setBusinessFlowTemplateId("6e4f3d20-c5c3-407f-9695-8460952bcc68");
accessReview.setDescription("Sample description");
LinkedList<AccessReviewReviewer> reviewers = new LinkedList<AccessReviewReviewer>();
AccessReviewReviewer accessReviewReviewer = new AccessReviewReviewer();
accessReviewReviewer.setId("f260246a-09b1-4fd5-8d18-daed736071ec");
reviewers.add(accessReviewReviewer);
AccessReviewReviewer accessReviewReviewer1 = new AccessReviewReviewer();
accessReviewReviewer1.setId("5a4e184c-4ee5-4883-96e9-b371f8da88e3");
reviewers.add(accessReviewReviewer1);
accessReview.setReviewers(reviewers);
AccessReviewSettings settings = new AccessReviewSettings();
settings.setMailNotificationsEnabled(true);
settings.setRemindersEnabled(true);
settings.setJustificationRequiredOnApproval(true);
settings.setAutoReviewEnabled(false);
settings.setActivityDurationInDays(30);
settings.setAutoApplyReviewResultsEnabled(false);
settings.setAccessRecommendationsEnabled(false);
AccessReviewRecurrenceSettings recurrenceSettings = new AccessReviewRecurrenceSettings();
recurrenceSettings.setRecurrenceType("onetime");
recurrenceSettings.setRecurrenceEndType("endBy");
recurrenceSettings.setDurationInDays(0);
recurrenceSettings.setRecurrenceCount(0);
settings.setRecurrenceSettings(recurrenceSettings);
AutoReviewSettings autoReviewSettings = new AutoReviewSettings();
autoReviewSettings.setNotReviewedResult("Deny");
settings.setAutoReviewSettings(autoReviewSettings);
accessReview.setSettings(settings);
AccessReview result = graphClient.accessReviews().post(accessReview);
const options = {
authProvider,
};
const client = Client.init(options);
const accessReview = {
displayName: 'TestReview',
startDateTime: '2017-02-10T00:35:53.214Z',
endDateTime: '2017-03-12T00:35:53.214Z',
reviewedEntity: {
id: '99025615-a0b1-47ec-9117-35377b10998b'
},
reviewerType: 'delegated',
businessFlowTemplateId: '6e4f3d20-c5c3-407f-9695-8460952bcc68',
description: 'Sample description',
reviewers:
[
{
id: 'f260246a-09b1-4fd5-8d18-daed736071ec'
},
{
id: '5a4e184c-4ee5-4883-96e9-b371f8da88e3'
}
],
settings:
{
mailNotificationsEnabled: true,
remindersEnabled: true,
justificationRequiredOnApproval: true,
autoReviewEnabled: false,
activityDurationInDays: 30,
autoApplyReviewResultsEnabled: false,
accessRecommendationsEnabled: false,
recurrenceSettings: {
recurrenceType: 'onetime',
recurrenceEndType: 'endBy',
durationInDays: 0,
recurrenceCount: 0
},
autoReviewSettings: {
notReviewedResult: 'Deny'
}
}
};
await client.api('/accessReviews')
.version('beta')
.post(accessReview);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\AccessReview;
use Microsoft\Graph\Beta\Generated\Models\Identity;
use Microsoft\Graph\Beta\Generated\Models\AccessReviewReviewer;
use Microsoft\Graph\Beta\Generated\Models\AccessReviewSettings;
use Microsoft\Graph\Beta\Generated\Models\AccessReviewRecurrenceSettings;
use Microsoft\Graph\Beta\Generated\Models\AutoReviewSettings;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AccessReview();
$requestBody->setDisplayName('TestReview');
$requestBody->setStartDateTime(new \DateTime('2017-02-10T00:35:53.214Z'));
$requestBody->setEndDateTime(new \DateTime('2017-03-12T00:35:53.214Z'));
$reviewedEntity = new Identity();
$reviewedEntity->setId('99025615-a0b1-47ec-9117-35377b10998b');
$requestBody->setReviewedEntity($reviewedEntity);
$requestBody->setReviewerType('delegated');
$requestBody->setBusinessFlowTemplateId('6e4f3d20-c5c3-407f-9695-8460952bcc68');
$requestBody->setDescription('Sample description');
$reviewersAccessReviewReviewer1 = new AccessReviewReviewer();
$reviewersAccessReviewReviewer1->setId('f260246a-09b1-4fd5-8d18-daed736071ec');
$reviewersArray []= $reviewersAccessReviewReviewer1;
$reviewersAccessReviewReviewer2 = new AccessReviewReviewer();
$reviewersAccessReviewReviewer2->setId('5a4e184c-4ee5-4883-96e9-b371f8da88e3');
$reviewersArray []= $reviewersAccessReviewReviewer2;
$requestBody->setReviewers($reviewersArray);
$settings = new AccessReviewSettings();
$settings->setMailNotificationsEnabled(true);
$settings->setRemindersEnabled(true);
$settings->setJustificationRequiredOnApproval(true);
$settings->setAutoReviewEnabled(false);
$settings->setActivityDurationInDays(30);
$settings->setAutoApplyReviewResultsEnabled(false);
$settings->setAccessRecommendationsEnabled(false);
$settingsRecurrenceSettings = new AccessReviewRecurrenceSettings();
$settingsRecurrenceSettings->setRecurrenceType('onetime');
$settingsRecurrenceSettings->setRecurrenceEndType('endBy');
$settingsRecurrenceSettings->setDurationInDays(0);
$settingsRecurrenceSettings->setRecurrenceCount(0);
$settings->setRecurrenceSettings($settingsRecurrenceSettings);
$settingsAutoReviewSettings = new AutoReviewSettings();
$settingsAutoReviewSettings->setNotReviewedResult('Deny');
$settings->setAutoReviewSettings($settingsAutoReviewSettings);
$requestBody->setSettings($settings);
$result = $graphServiceClient->accessReviews()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.Governance
$params = @{
displayName = "TestReview"
startDateTime = [System.DateTime]::Parse("2017-02-10T00:35:53.214Z")
endDateTime = [System.DateTime]::Parse("2017-03-12T00:35:53.214Z")
reviewedEntity = @{
id = "99025615-a0b1-47ec-9117-35377b10998b"
}
reviewerType = "delegated"
businessFlowTemplateId = "6e4f3d20-c5c3-407f-9695-8460952bcc68"
description = "Sample description"
reviewers = @(
@{
id = "f260246a-09b1-4fd5-8d18-daed736071ec"
}
@{
id = "5a4e184c-4ee5-4883-96e9-b371f8da88e3"
}
)
settings = @{
mailNotificationsEnabled = $true
remindersEnabled = $true
justificationRequiredOnApproval = $true
autoReviewEnabled = $false
activityDurationInDays = 30
autoApplyReviewResultsEnabled = $false
accessRecommendationsEnabled = $false
recurrenceSettings = @{
recurrenceType = "onetime"
recurrenceEndType = "endBy"
durationInDays = 0
recurrenceCount = 0
}
autoReviewSettings = @{
notReviewedResult = "Deny"
}
}
}
New-MgBetaAccessReview -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.access_review import AccessReview
from msgraph_beta.generated.models.identity import Identity
from msgraph_beta.generated.models.access_review_reviewer import AccessReviewReviewer
from msgraph_beta.generated.models.access_review_settings import AccessReviewSettings
from msgraph_beta.generated.models.access_review_recurrence_settings import AccessReviewRecurrenceSettings
from msgraph_beta.generated.models.auto_review_settings import AutoReviewSettings
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AccessReview(
display_name = "TestReview",
start_date_time = "2017-02-10T00:35:53.214Z",
end_date_time = "2017-03-12T00:35:53.214Z",
reviewed_entity = Identity(
id = "99025615-a0b1-47ec-9117-35377b10998b",
),
reviewer_type = "delegated",
business_flow_template_id = "6e4f3d20-c5c3-407f-9695-8460952bcc68",
description = "Sample description",
reviewers = [
AccessReviewReviewer(
id = "f260246a-09b1-4fd5-8d18-daed736071ec",
),
AccessReviewReviewer(
id = "5a4e184c-4ee5-4883-96e9-b371f8da88e3",
),
],
settings = AccessReviewSettings(
mail_notifications_enabled = True,
reminders_enabled = True,
justification_required_on_approval = True,
auto_review_enabled = False,
activity_duration_in_days = 30,
auto_apply_review_results_enabled = False,
access_recommendations_enabled = False,
recurrence_settings = AccessReviewRecurrenceSettings(
recurrence_type = "onetime",
recurrence_end_type = "endBy",
duration_in_days = 0,
recurrence_count = 0,
),
auto_review_settings = AutoReviewSettings(
not_reviewed_result = "Deny",
),
),
)
result = await graph_client.access_reviews.post(request_body)