Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Append additional certificate authority details to a certificateBasedAuthPki resource. Only one operation can run at a time and this operation can take up to 30 minutes to complete. To know whether another upload is in progress, call the Get certificateBasedAuthPki. The status property will have the value running
.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissions
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) |
PublicKeyInfrastructure.ReadWrite.All |
Not available. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
PublicKeyInfrastructure.ReadWrite.All |
Not available. |
Important
In delegated scenarios with work or school accounts where the signed-in user is acting on another user, they must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation.
- Privileged Authentication Administrator
- Authentication Administrator
HTTP request
POST /directory/publicKeyInfrastructure/certificateBasedAuthConfigurations/{certificateBasedAuthPkiId}/upload
Request body
In the request body, supply a JSON representation of the parameters.
The following table lists the parameters that are required when you call this action.
Parameter |
Type |
Description |
uploadUrl |
String |
The URL where the service can download the PKI file and populate the certificateAuthorities. This can be any http or https publicly accessible internet facing URL. |
sha256FileHash |
String |
A sequence of numbers and letters to check that your copy of a downloaded update file is identical to the original. This can be computed using the Get_FileHash cmdlet. |
Response
If successful, this action returns a 204 No Content
response code. If another upload is currently in progress, this API returns a 400 Bad Request error message. Attempting to upload a duplicate certificate results in a 400 Bad Request error code with a Duplicate Certificate exists" error message.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/directory/publicKeyInfrastructure/certificateBasedAuthConfigurations/{certificateBasedAuthPkiId}/upload
Content-Type: application/json
{
"uploadUrl": "https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b",
"sha256FileHash": "D7F9....61E6F"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.DirectoryNamespace.PublicKeyInfrastructure.CertificateBasedAuthConfigurations.Item.Upload;
var requestBody = new UploadPostRequestBody
{
UploadUrl = "https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b",
Sha256FileHash = "D7F9....61E6F",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Directory.PublicKeyInfrastructure.CertificateBasedAuthConfigurations["{certificateBasedAuthPki-id}"].Upload.PostAsync(requestBody);
mgc-beta directory public-key-infrastructure certificate-based-auth-configurations upload post --certificate-based-auth-pki-id {certificateBasedAuthPki-id} --body '{\
"uploadUrl": "https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b",\
"sha256FileHash": "D7F9....61E6F"\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphdirectory "github.com/microsoftgraph/msgraph-beta-sdk-go/directory"
//other-imports
)
requestBody := graphdirectory.NewUploadPostRequestBody()
uploadUrl := "https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b"
requestBody.SetUploadUrl(&uploadUrl)
sha256FileHash := "D7F9....61E6F"
requestBody.SetSha256FileHash(&sha256FileHash)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Directory().PublicKeyInfrastructure().CertificateBasedAuthConfigurations().ByCertificateBasedAuthPkiId("certificateBasedAuthPki-id").Upload().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.beta.directory.publickeyinfrastructure.certificatebasedauthconfigurations.item.upload.UploadPostRequestBody uploadPostRequestBody = new com.microsoft.graph.beta.directory.publickeyinfrastructure.certificatebasedauthconfigurations.item.upload.UploadPostRequestBody();
uploadPostRequestBody.setUploadUrl("https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b");
uploadPostRequestBody.setSha256FileHash("D7F9....61E6F");
graphClient.directory().publicKeyInfrastructure().certificateBasedAuthConfigurations().byCertificateBasedAuthPkiId("{certificateBasedAuthPki-id}").upload().post(uploadPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const upload = {
uploadUrl: 'https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b',
sha256FileHash: 'D7F9....61E6F'
};
await client.api('/directory/publicKeyInfrastructure/certificateBasedAuthConfigurations/{certificateBasedAuthPkiId}/upload')
.version('beta')
.post(upload);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Directory\PublicKeyInfrastructure\CertificateBasedAuthConfigurations\Item\Upload\UploadPostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new UploadPostRequestBody();
$requestBody->setUploadUrl('https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b');
$requestBody->setSha256FileHash('D7F9....61E6F');
$graphServiceClient->directory()->publicKeyInfrastructure()->certificateBasedAuthConfigurations()->byCertificateBasedAuthPkiId('certificateBasedAuthPki-id')->upload()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
$params = @{
uploadUrl = "https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b"
sha256FileHash = "D7F9....61E6F"
}
Invoke-MgBetaUploadDirectoryPublicKeyInfrastructureCertificateBasedAuthConfiguration -CertificateBasedAuthPkiId $certificateBasedAuthPkiId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.directory.publickeyinfrastructure.certificatebasedauthconfigurations.item.upload.upload_post_request_body import UploadPostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = UploadPostRequestBody(
upload_url = "https://microsoft.sharepoint.com/CBA/demo/CBARootPKI.p7b",
sha256_file_hash = "D7F9....61E6F",
)
await graph_client.directory.public_key_infrastructure.certificate_based_auth_configurations.by_certificate_based_auth_pki_id('certificateBasedAuthPki-id').upload.post(request_body)
Response
The following example shows the response.
HTTP/1.1 204 No Content