Erstellt eine permissionGrantPolicy. Eine Berechtigungserteilungsrichtlinie wird verwendet, um die Bedingungen zu beschreiben, unter denen Berechtigungen erteilt werden können (z. B. während der Anwendungszustimmung).
Wählen Sie für diese API die Als am wenigsten privilegierten Berechtigungen gekennzeichneten Berechtigungen aus. Verwenden Sie nur dann eine Berechtigung mit höheren Berechtigungen , wenn dies für Ihre App erforderlich ist. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
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);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewPermissionGrantPolicy()
id := "my-custom-consent-policy"
requestBody.SetId(&id)
displayName := "Custom application consent policy"
requestBody.SetDisplayName(&displayName)
description := "A custom permission grant policy to customize conditions for granting consent."
requestBody.SetDescription(&description)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
permissionGrantPolicies, err := graphClient.Policies().PermissionGrantPolicies().Post(context.Background(), requestBody, nil)
// 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);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\PermissionGrantPolicy;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PermissionGrantPolicy();
$requestBody->setId('my-custom-consent-policy');
$requestBody->setDisplayName('Custom application consent policy');
$requestBody->setDescription('A custom permission grant policy to customize conditions for granting consent.');
$result = $graphServiceClient->policies()->permissionGrantPolicies()->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.permission_grant_policy import PermissionGrantPolicy
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PermissionGrantPolicy(
id = "my-custom-consent-policy",
display_name = "Custom application consent policy",
description = "A custom permission grant policy to customize conditions for granting consent.",
)
result = await graph_client.policies.permission_grant_policies.post(request_body)