Hello Phillipe , welcome to MS Q&A
When retrieving a PFX certificate from Azure Key Vault using Azure CLI, you may encounter issues during conversion to PEM format. To successfully convert a PFX certificate to PEM, ensure that you are using the correct command to download the certificate and that the private key is included in the PFX file.
If you are facing specific errors during the conversion process, it may be helpful to check the format of the certificate and ensure that it adheres to the required specifications. Additionally, verify that you are using the appropriate tools or commands for the conversion.
- To retrieve a PFX certificate from Azure Key Vault and convert it to PEM format using Azure CLI and OpenSSL, you can use the following commands:
az keyvault certificate download --vault-name <your-key-vault-name> --name <your-certificate-name> --file <path-to-save-certificate.pfx> --encoding Pfx
- Convert the PFX certificate to PEM format using OpenSSL:
openssl pkcs12 -in <path-to-save-certificate.pfx> -out <path-to-save-certificate.pem> -nodes -passin pass:<pfx-password>
Replace the placeholders <your-key-vault-name>, <your-certificate-name>, <path-to-save-certificate.pfx>, <path-to-save-certificate.pem>, and <pfx-password> with your actual values.
These commands will ensure that the private key and chain are included in the PEM file.
References:
- Export certificates from Azure Key Vault
- Read more about exporting certificates from Azure Key Vault
Please try and let us know if any questions
Kindly accept answer if it helps
Thanks
Deepanshu