Issue: We don’t want to store our .pfx certificates in any Build servers or in code base.
Solution: Maintain .pfx certificates in the base64 encoded format on Build servers and then generate .pfx during deployment phase.
Note: You have to make use of this powershell script on your daily build definition to generate .pfx certificate from base64 string.
So let us see how we do this encoding and decoding of .pfx certificate.
$bytes = [System.IO.File]::ReadAllBytes(“C:\temp\Authentication.pfx”)
$base64String = [System.Convert]::ToBase64String($bytes);
Write-Output “Below is the Output of encoded base64 string”
Write-Output “Done Saving PFX file”