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.
Berechtigungstyp
Berechtigungen mit den geringsten Berechtigungen
Berechtigungen mit höheren Berechtigungen
Delegiert (Geschäfts-, Schul- oder Unikonto)
Policy.ReadWrite.PermissionGrant
Nicht verfügbar.
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Nicht unterstützt
Anwendung
Policy.ReadWrite.PermissionGrant
Nicht verfügbar.
HTTP-Anforderung
Sie können den Dienstprinzipal entweder mit seiner ID oder appId adressieren.
id und appId werden in App-Registrierungen im Microsoft Entra Admin Center als Objekt-ID bzw. Anwendungs-ID (Client-ID) bezeichnet.
POST /servicePrincipals/{id}/delegatedPermissionClassifications
POST /servicePrincipals(appId='{appId}')/delegatedPermissionClassifications
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new DelegatedPermissionClassification
{
PermissionId = "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
PermissionName = "User.Read",
Classification = PermissionClassificationType.Low,
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.ServicePrincipals["{servicePrincipal-id}"].DelegatedPermissionClassifications.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.NewDelegatedPermissionClassification()
permissionId := "e1fe6dd8-ba31-4d61-89e7-88639da4683d"
requestBody.SetPermissionId(&permissionId)
permissionName := "User.Read"
requestBody.SetPermissionName(&permissionName)
classification := graphmodels.LOW_PERMISSIONCLASSIFICATIONTYPE
requestBody.SetClassification(&classification)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
delegatedPermissionClassifications, err := graphClient.ServicePrincipals().ByServicePrincipalId("servicePrincipal-id").DelegatedPermissionClassifications().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DelegatedPermissionClassification delegatedPermissionClassification = new DelegatedPermissionClassification();
delegatedPermissionClassification.setPermissionId("e1fe6dd8-ba31-4d61-89e7-88639da4683d");
delegatedPermissionClassification.setPermissionName("User.Read");
delegatedPermissionClassification.setClassification(PermissionClassificationType.Low);
DelegatedPermissionClassification result = graphClient.servicePrincipals().byServicePrincipalId("{servicePrincipal-id}").delegatedPermissionClassifications().post(delegatedPermissionClassification);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\DelegatedPermissionClassification;
use Microsoft\Graph\Generated\Models\PermissionClassificationType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DelegatedPermissionClassification();
$requestBody->setPermissionId('e1fe6dd8-ba31-4d61-89e7-88639da4683d');
$requestBody->setPermissionName('User.Read');
$requestBody->setClassification(new PermissionClassificationType('low'));
$result = $graphServiceClient->servicePrincipals()->byServicePrincipalId('servicePrincipal-id')->delegatedPermissionClassifications()->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.delegated_permission_classification import DelegatedPermissionClassification
from msgraph.generated.models.permission_classification_type import PermissionClassificationType
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DelegatedPermissionClassification(
permission_id = "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
permission_name = "User.Read",
classification = PermissionClassificationType.Low,
)
result = await graph_client.service_principals.by_service_principal_id('servicePrincipal-id').delegated_permission_classifications.post(request_body)