Creates a permissionGrantPolicy. A permission grant policy is used to describe the conditions under which permissions can be granted (for example, during application consent).
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.
POST https://graph.microsoft.com/v1.0/policies/permissionGrantPolicies
Content-Type: application/json
{
"id": "my-custom-consent-policy",
"displayName": "Custom application consent policy",
"description": "A custom permission grant policy to customize conditions for granting consent."
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new PermissionGrantPolicy
{
Id = "my-custom-consent-policy",
DisplayName = "Custom application consent policy",
Description = "A custom permission grant policy to customize conditions for granting consent.",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Policies.PermissionGrantPolicies.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc policies permission-grant-policies create --body '{\
"id": "my-custom-consent-policy",\
"displayName": "Custom application consent policy",\
"description": "A custom permission grant policy to customize conditions for granting consent."\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PermissionGrantPolicy permissionGrantPolicy = new PermissionGrantPolicy();
permissionGrantPolicy.setId("my-custom-consent-policy");
permissionGrantPolicy.setDisplayName("Custom application consent policy");
permissionGrantPolicy.setDescription("A custom permission grant policy to customize conditions for granting consent.");
PermissionGrantPolicy result = graphClient.policies().permissionGrantPolicies().post(permissionGrantPolicy);
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.