Command to create a certificate with a private key (pfx)

This batch file will create a certificate (.cer) and a certificate with a private key (.pfx). Useful for creating self signed SSL certificates on Azure!

The first argument is the certificate name, the second is the password:

makecert -sky exchange -r -n "CN=%~1" -a sha1 -len 2048 -pe -ss My "%~1.cer"
certutil.exe -user -p "%~2" -exportPFX -privatekey "%~1" "%~1.pfx"

You’ll probably need to run it from the Visual Studio command prompt.