Hello all,
I am trying to import a certificate/private key with userPFXCertificate using the Graph API Beta Java library to add this feature to our PKI product.
The code sample in the documentation page (Create UserPFXCertificate) seemed pretty straightforward. I adapted it for Java. But I have no luck and the error message does not have any detail on the error.
I have created a dedicated Intune trusted certificate profile, a PKCS certificate profile
Here the produced JSON body, I have anonymised or truncated some of the values:
{
"createdDateTime":"2024-10-02T14:52:55.997567041Z",
"encryptedPfxBlob":"MIIRzwIBAzCCEYgGCSqGSIb3DQEHAaCCEXkEghF1MIIRc...MAkGBSsOAwIaBQAEFJ5jjPNAiya0dvPEfAu75jlL23fPBBTNgCjXLxyVNDZSETwM/2RNKWUeNAIDAYag",
"encryptedPfxPassword":"SdeVjSGbnMbGclpPBdUsGAS1A9ZDZnGYQ26oO+Id4...l4uTsY4HSsCM26umLF5q1fhi1kzrFvTnXd70AEyopdTk84TpztAph9+pcWaA==",
"expirationDateTime":"2032-03-06T09:04:48Z",
"intendedPurpose":"smimeEncryption",
"keyName":"<NAME OF THE INTUNE TRUSTED CERTIFICATE PROFILE>",
"lastModifiedDateTime":"2024-10-02T14:52:55.99760599Z",
"paddingScheme":"oaepSha256",
"providerName":"<NAME OF OUR PROVIDER>",
"startDateTime":"2022-03-09T09:04:48Z",
"thumbprint":"iSsIpYjk64QAZEQW2e/Wuv2jN3g=",
"userPrincipalName":"<USER UPN>" // is this supposed to be an email address ?
}
The error message:
http status: 400
com.microsoft.graph.beta.models.odataerrors.ODataError: { "_version": 3, "Message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 5a0de11e-aa87-4c8b-9f5d-XXXXXXX1137 - Url: https://fef.amsub0502.manage.microsoft.com/RACerts/StatelessImportPFXService/XXXXXXXX-ffff-XXXX-XXXX-092622171078/deviceManagement/userPfxCertificates?api-version=5022-06-22", "CustomApiErrorPhrase": "", "RetryAfter": null, "ErrorSourceService": "", "HttpHeaders": "{}"}
Using the UserPFXCertificate list works fine so I think it is not a configuration problem.
Any idea ?
Thanks in advance !