If you are working with Azure cloud or any other services that require a PFX certificate, here is an easy way to create a certificate.
Create vs.bat as below
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
Be sure to replace that with a path valid for your system, of course. Alternatively, skip this step and instead open up a visual studio command prompt.
Create pfx.bat as below
echo Create a new password at the pop-up.
echo This is NOT the same as the one you provided above.
echo You'll be asked to create, confirm and re-enter the password (total 3 times)
echo Creating Certificate (CER) and Key (PVK).
makecert.exe -sv %1.pvk -n "CN=%2" %1.cer
echo On prompt, again (4th and last time) provide the password you just created.
echo Merging the two files into a PFX now.
pvk2pfx.exe -pvk %1.pvk -spc %1.cer -pfx %1.pfx -po %3
- Open a command prompt (Run > cmd) and cd to the folder where above batch files were created
vs.batwith no parameters
pfx.bat <pfx-file-name> <cert-name> <pfx-password>
- pfx-file-name: Name of the certificate file (say, mypfx). Any valid file name, without spaces.
- cert-name: Name of the certificate (say, MyApplicationCertificate), without spaces
- pfx-password: Password for the PFX. This is different from the PVK password that you will be prompted for.
Note that the “without spaces” restriction is due to limitations of the batch file that I’ve done in a hurry. If you wish to have spaces, either use the commands directly or improve the batch file.