For years I was able to upload new pfx files for SSL binding on Azure App Services using the OpenSSL creation method in this Stack Overflow answer:
openssl pkcs12 -export -out domain.name.pfx -inkey domain.name.key -in domain.name.crt
However, doing the same now provides this error:
At least one certificate is not valid (Certificate failed validation because it could not be loaded.)
What ways can this issue be resolved?
3
Answers
App Service private certificate requirements
App Service private certificates must meet the following requirements:
Option 1: Use legacy provider in OpenSSL 3+
OpenSSL 3+ no longer uses DES encryption as a default. The original command needs the
-legacy
and-provider-path
(path tolegacy.dll
) arguments appended:Option 2: Let Windows re-encrypt the file
If for some reason your OpenSSL installation does not contain the legacy provider:
Open PowerShell and run this command, replacing
-FilePath
with the path to your non-working pfx file, and the password-String
argument with its respective password:A successful output will look like:
Use this thumbprint to export the cert to a new pfx file, replacing the
-Cert
,-FilePath
, and password-String
arguments:Azure should now be able to validate the new pfx file output.
If the specific error is
And if you are using the following script from OpenSSL to generate
And if this is the issue, then….
OpenSSL 3 generates a longer certificate serial number when you run the pfx generation script. I would suggest downloading the OpenSSL 1 from the portal (https://slproweb.com/products/Win32OpenSSL.html) and this should help generate a shorter certificate serial number which Azure pfx import tool will accept
Reference – https://learn.microsoft.com/en-us/answers/questions/192112/error-message-occurs-when-trying-to-upload-pfx-cer.html
For me, the issue was simply solved by changing the password. My previous password had special characters, which then i changed to only alphabetic letters.