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.
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}/removePassword
POST /servicePrincipals(appId='{appId}')/removePassword
POST https://graph.microsoft.com/v1.0/servicePrincipals/{id}/removePassword
Content-type: application/json
{
"keyId": "f0b0b335-1d71-4883-8f98-567911bfdca6"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.ServicePrincipals.Item.RemovePassword;
var requestBody = new RemovePasswordPostRequestBody
{
KeyId = Guid.Parse("f0b0b335-1d71-4883-8f98-567911bfdca6"),
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.ServicePrincipals["{servicePrincipal-id}"].RemovePassword.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"github.com/google/uuid"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphserviceprincipals "github.com/microsoftgraph/msgraph-sdk-go/serviceprincipals"
//other-imports
)
requestBody := graphserviceprincipals.NewRemovePasswordPostRequestBody()
keyId := uuid.MustParse("f0b0b335-1d71-4883-8f98-567911bfdca6")
requestBody.SetKeyId(&keyId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.ServicePrincipals().ByServicePrincipalId("servicePrincipal-id").RemovePassword().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.serviceprincipals.item.removepassword.RemovePasswordPostRequestBody removePasswordPostRequestBody = new com.microsoft.graph.serviceprincipals.item.removepassword.RemovePasswordPostRequestBody();
removePasswordPostRequestBody.setKeyId(UUID.fromString("f0b0b335-1d71-4883-8f98-567911bfdca6"));
graphClient.servicePrincipals().byServicePrincipalId("{servicePrincipal-id}").removePassword().post(removePasswordPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\ServicePrincipals\Item\RemovePassword\RemovePasswordPostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RemovePasswordPostRequestBody();
$requestBody->setKeyId('f0b0b335-1d71-4883-8f98-567911bfdca6');
$graphServiceClient->servicePrincipals()->byServicePrincipalId('servicePrincipal-id')->removePassword()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.serviceprincipals.item.remove_password.remove_password_post_request_body import RemovePasswordPostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RemovePasswordPostRequestBody(
key_id = UUID("f0b0b335-1d71-4883-8f98-567911bfdca6"),
)
await graph_client.service_principals.by_service_principal_id('servicePrincipal-id').remove_password.post(request_body)