I currently have an application set up in my Azure Registered Apps, and I'm unable to add my public key under 'Certificates & Secrets'. I tried generating a key like this, and the resulting public (or private, for that matter) key (.pem
) was unable to be added to the app. I'm using this key for some work with JWTs, so I thought that maybe I'd need a slightly different format, so I tried making a pair like this as well. Still no luck.
The only way I was able to get some form of credential added to the app was actually creating & self-signing a .crt
with the previously generated keypair, that is the only case where Azure has not complained about me adding a credential.
Trying to add anything else, even the public .pem
, which it says IS a supported filetype, gives this error:
Failed to add certificate. Error detail: Upload a certificate (public key) with one of the following file types: .cer, .pem, .crt [8jpdkHO8jJ6PaePjw7NvbJ]
Having the .crt
uploaded simply won't suffice, the fingerprint on my private key that I'm using with jwt.decode()
aren't matching up with what is registered on Azure, causing errors.
I don't use stackoverflow often, so not sure on etiquette and whether re-posting after your answer has been deleted is ok. either way, I've fixed it up and added the actual steps, rather than just linking to them.
Following the certificate generation instructions here allowed me to upload the public key.
The steps are as follows:
Generate Certificate
openssl req -x509 -days 3650 -newkey rsa:2048 -keyout key.pem -out cert.pem
Grab Thumbprint
echo $(openssl x509 -in cert.pem -fingerprint -noout) | sed ‘s/SHA1 Fingerprint=//g’ | sed ‘s/://g’ | xxd -r -ps | base64
You should then have a certificate azure will allow you to upload, as well as the thumbprint to use in any requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With