Chargez une clé de format PKCS 12 (.pfx) dans la configuration d’authentification d’un connecteur d’API. L’entrée est une valeur codée en base 64 du contenu du certificat PKCS 12. Cette méthode retourne un apiConnector.
Dans les scénarios délégués avec des comptes professionnels ou scolaires, l’utilisateur connecté doit se voir attribuer un rôle Microsoft Entra pris en charge ou un rôle personnalisé avec une autorisation de rôle prise en charge.
ID externe’administrateur de flux utilisateur est le rôle le moins privilégié pris en charge pour cette opération.
Requête HTTP
POST /identity/apiconnectors/{id}/uploadClientCertificate
Dans le corps de la demande, indiquez un objet JSON avec les paramètres suivants.
Propriété
Type
Description
pkcs12Value
String
Il s’agit du champ pour l’envoi du contenu pfx. La valeur doit être une version encodée en base 64 du contenu du certificat réel. Obligatoire.
mot de passe
Chaîne
Il s’agit du mot de passe du fichier pfx. Obligatoire. Si aucun mot de passe n’est utilisé, doit toujours fournir la valeur .""
Réponse
Si elle réussit, cette méthode renvoie un 200 OK code de réponse et l’apiConnector dont authenticationConfiguration contient les informations publiques du certificat client.
POST https://graph.microsoft.com/v1.0/identity/apiconnectors/{id}/uploadClientCertificate
Content-type: application/json
{
"pkcs12Value": "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...kDJ04sJShkkgjL9Bm49plA",
"password": "<password>"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Identity.ApiConnectors.Item.UploadClientCertificate;
var requestBody = new UploadClientCertificatePostRequestBody
{
Pkcs12Value = "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...kDJ04sJShkkgjL9Bm49plA",
Password = "<password>",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.ApiConnectors["{identityApiConnector-id}"].UploadClientCertificate.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"
graphidentity "github.com/microsoftgraph/msgraph-sdk-go/identity"
//other-imports
)
requestBody := graphidentity.NewUploadClientCertificatePostRequestBody()
pkcs12Value := "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...kDJ04sJShkkgjL9Bm49plA"
requestBody.SetPkcs12Value(&pkcs12Value)
password := "<password>"
requestBody.SetPassword(&password)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
uploadClientCertificate, err := graphClient.Identity().ApiConnectors().ByIdentityApiConnectorId("identityApiConnector-id").UploadClientCertificate().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.identity.apiconnectors.item.uploadclientcertificate.UploadClientCertificatePostRequestBody uploadClientCertificatePostRequestBody = new com.microsoft.graph.identity.apiconnectors.item.uploadclientcertificate.UploadClientCertificatePostRequestBody();
uploadClientCertificatePostRequestBody.setPkcs12Value("eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...kDJ04sJShkkgjL9Bm49plA");
uploadClientCertificatePostRequestBody.setPassword("<password>");
var result = graphClient.identity().apiConnectors().byIdentityApiConnectorId("{identityApiConnector-id}").uploadClientCertificate().post(uploadClientCertificatePostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Identity\ApiConnectors\Item\UploadClientCertificate\UploadClientCertificatePostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UploadClientCertificatePostRequestBody();
$requestBody->setPkcs12Value('eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...kDJ04sJShkkgjL9Bm49plA');
$requestBody->setPassword('<password>');
$result = $graphServiceClient->identity()->apiConnectors()->byIdentityApiConnectorId('identityApiConnector-id')->uploadClientCertificate()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.identity.apiconnectors.item.upload_client_certificate.upload_client_certificate_post_request_body import UploadClientCertificatePostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UploadClientCertificatePostRequestBody(
pkcs12_value = "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...kDJ04sJShkkgjL9Bm49plA",
password = "<password>",
)
result = await graph_client.identity.api_connectors.by_identity_api_connector_id('identityApiConnector-id').upload_client_certificate.post(request_body)