Get SSL cert in PFX format using OpenSSL

Steps for getting SSL certificate in pfx format (suitable for Azure for example)

openssl req -new -nodes -keyout mycert.key -out mycert.csr -newkey rsa:2048

Upload CSR, get the Certificate and save it local file. Get the intermediate certificates (if needed).

Concatenate the intermedia certs to one file:

cat AddTrustExternalCARoot.crt COMODORSA* > intermediates.crt

Export:

openssl pkcs12 -chain -export -out mycert.pfx -inkey mycert.key -in mycert.crt -CAfile intermediates.crt