title: NETWORK SERVICE user cannot read certificate windows server 2012
body: <p>I have a local service running on my windows 2012 server machine. It is a azure service fabric cluster with one node, but this shouldn't matter for this problem.</p>
  
  <p>The service runs under the "NETWORK SERVICE: user, and has code that accesses a certificate stored on local machine. The code that finds the certificate using <a href="https://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate2collection.find(v=vs.110).aspx" rel="nofollow noreferrer">X509Certificate2Collection.Find</a> method.</p>
  
  <p>The exception is:</p>
  
  <blockquote>
    <p>Exception thrown: 'System.AggregateException' in mscorlib.dll</p>
    
    <p>Additional information: Could not successfully acquire access token
    using thumbprints: 80CEA40A62FFA0116FCB40B7B5985ADCD3E5AC39</p>
  </blockquote>
  
  <p>When I execute the same Find function with same parameters locally as admin user, it works.</p>
  
  <p>I have tried explicitly granting the NETWORK SERVICE user read permission on the certificate, but this did not solve it.</p>
  
  <p>I have also tried executing code locally under NETWORK SERVICE user context (not as deployed local service, but local executable code snippet) that gets a certificate, and this works, which is strange.</p>