Upload a PKCS 12 format key (.pfx) to an API connector's authentication configuration. The input is a base-64 encoded value of the PKCS 12 certificate contents. This method returns an apiConnector.
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.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
APIConnectors.ReadWrite.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
APIConnectors.ReadWrite.All
Not available.
The work or school account needs to belong to at least the External ID User Flow AdministratorMicrosoft Entra role.
HTTP request
POST /identity/apiconnectors/{id}/uploadClientCertificate
In the request body, provide a JSON object with the following parameters.
Property
Type
Description
pkcs12Value
String
This is the field for sending the pfx content. The value should be a base-64 encoded version of the actual certificate content. Required.
password
String
This is the password for the pfx file. Required. If no password is used, must still provide a value of "".
Response
If successful, this method returns a 200 OK response code and the apiConnector whose authenticationConfiguration contains the public information of the client certificate.
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);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc identity api-connectors upload-client-certificate post --identity-api-connector-id {identityApiConnector-id} --body '{\
"pkcs12Value": "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ...kDJ04sJShkkgjL9Bm49plA",\
"password": "<password>"\
}\
'
// 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\Models\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();
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.