Azure key vault -- The specified PEM X.509 certificate content can not be read. Please check if certificate is in valid PEM format. Accepted formats: PEM content or Base64 encoded PEM content

M, Murugeswari (Cognizant) 456 Reputation points
2022-04-18T17:31:34.67+00:00

We have a exported the certificate in Base64 encoded PKCS #8 (.PEM) Format and kept in our local system. We need to import it in Azure key vault. When I tried to do that, I am getting below error:-

The specified PEM X.509 certificate content can not be read. Please check if certificate is in valid PEM format. Accepted formats: PEM content or Base64 encoded PEM content.

193905-image.png

Certificate format:-

-----BEGIN PRIVATE KEY-----
MIIE6TAbBgoqhkiG9w0BDAEDMA0ECGhtCDicYGGyAgEBBIIEyBhR+hx9p0yNzhWGJbOqlIcFWhnj
wIvzcV22ypt6twtSqyDG/0RralPIfy3gMuXD7PrVXe8d4BPmUbhb5ce01w7Jk4SmcBOfOeBCbJ7A
xb7YR8l/53AoEpxXzJjSCjC9nGso1527K9tem/Ss6bXSfAAzSV7sym5b/JCA8NoinbBrf5xTCKC4
9VbP1PWbWk3Gz92uzATgG92wUxZmBNnazUdbYMUwPohyzgepUlEo+typlIifVTvtawYPhmlNF8tb
.
.
.
.
-----END PRIVATE KEY-----

Kindly give us the solution

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. risolis 8,741 Reputation points
    2022-04-19T02:06:51.017+00:00

    Hello @Anonymous

    Thanks for your question!

    I found this doc and this might provide you some feedback. See it below:

    https://github.com/MicrosoftDocs/azure-docs/issues/23558

    BR,

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Trilok Mohnani 0 Reputation points
    2023-12-08T06:16:02.6733333+00:00
    1. Ensure you have openssl is installed on your local machine.
    2. export the privatekey.pem and certificate.pem to pfx with following command:

    openssl pkcs12 -inkey privatekey.pem -in CCSID.pem -export -passout pass:$password -out CCSID.pfx

    1. import the exported pfx file to local windows machine with the password set in previous step ($password)
    2. Export the pfx with private key from local windows machine and encryption $password:
    3. Import the exported pfx file from step 4 on Azure key vault with the above $password and it should work fine and that worked for me also.

    Best regards,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.