Azure Key Vault – The file type of the certificate to be imported must be .pfx or .pem

I was trying to import some existing certificates into Key Vault, using the Azure portal. All certificates were in PFX format and had a private key, but for some reason trying to import some of them was failing with the following error:

The file type of the certificate to be imported must be .pfx or .pem


https://user-images.githubusercontent.com/761098/55885240-e1f45e80-5ba9-11e9-92fd-cf45419efc64.png

After spending a couple of hours a colleague of mine suggested to change the file extension to lowercase, and guess what? It worked! The error message was not being displayed anymore:

https://user-images.githubusercontent.com/761098/55885507-5cbd7980-5baa-11e9-955e-ae584634f412.png

This is not the kind of bug I’d expect from the Microsoft guys, but hey they’re only human. Luckily I was able to find an easy workaround, otherwise I’d have to use Powershell or .NET code to import the certificate.

That’s it, happy coding! šŸ™‚