title: X509Certificate2 failing in Azure Webjobs calling Google API
body: <p>I have a console app that is scheduled using Azure WebJobs. The execution always fails when attempting to read the private key of p12 certificate. Interestingly enough I can't catch the exception, I've had to use good old <code>Console.WriteLine</code> to debug.</p>
  
  <p>Here is my snippet of code:</p>
  
  <pre class="lang-csharp prettyprint-override"><code>var certificate = new X509Certificate2(data, "notasecret", X509KeyStorageFlags.Exportable);
  
  ServiceAccountCredential credential = new ServiceAccountCredential(
   new ServiceAccountCredential.Initializer(serviceAccountEmail)
   {
       Scopes = new[] { BigqueryService.Scope.Bigquery }
   }.FromCertificate(certificate));
  </code></pre>
  
  <p>Other posts have mention that the flags should be <code>X509KeyStorageFlags.MachineKeySet</code> but unfortunately that causes an error in the Google API. It requires the <code>X509KeyStorageFlags.Exportable</code> flag to be set.</p>
  
  <p>Can anyone confirm that <code>X509KeyStorageFlags.Exportable</code> is usable on Azure Websites and WebJobs? </p>