I built a Azure web job console which is referring Windows Azure Management Libraries. I tried to authenticate my app by using public setting approach.
The program is working fine on my local, but failing on Azure Web Jobs with X509Certificates error.
This is how I did for the web job program.
Downloaded publish setting file from https://windows.azure.com/download/publishprofile.aspx
On console app, create credential by copy & paste subscriptionId and cert string from the setting file.
new CertificateCloudCredentials( subscriptionId, new 509Certificate2(Convert.FromBase64String(base64EncodedCertificate)));
Deployed & tried "Run on Demand" on Azure Web Job.
The error
at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx) at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] data) at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData)
Exception while executing:
System.Security.Cryptography.CryptographicException, The system cannot find the file specified.