title: Windows Azure Management Certificate not found in WebService
body: <p>I want to use the Windows Azure Management API to scale my webservice programmatically. First I try to get my Management Certificate.</p>
  
  <p>I created a new self signed cert using the makecert.exe. Its described <a href="http://msdn.microsoft.com/en-us/library/windowsazure/gg432987.aspx" rel="nofollow">here</a>.</p>
  
  <pre><code>makecert -sky exchange -r -n "CN=&lt;CertificateName&gt;" -pe -a sha1 -len 2048 -ss My "&lt;CertificateName&gt;.cer"
  </code></pre>
  
  <p>Then I uploaded my cert to my azure subscription (<a href="http://msdn.microsoft.com/en-us/library/windowsazure/gg551726.aspx" rel="nofollow">this way</a>).
  I really see my uploaded certificate in the new and in the previous admin portal.</p>
  
  <p>Now I add the following <a href="http://msdn.microsoft.com/en-us/library/ee460782.aspx" rel="nofollow">code</a> to my webservice </p>
  
  <pre><code>private X509Certificate2 GetX509Certificate2()
      {
  
          // The thumbprint value of the management certificate.
          // You must replace the string with the thumbprint of a 
          // management certificate associated with your subscription.
          string certThumbprint = "mythumprint...";
  
          // Create a reference to the My certificate store.
          X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
  
          // Try to open the store.
          try
          {
              certStore.Open(OpenFlags.ReadOnly);
          }
          catch (Exception e)
          {
              if (e is CryptographicException)
              {
                  Console.WriteLine("Error: The store is unreadable.");
                  debugTable.persist("Error: The store is unreadable.");
              }
              else if (e is SecurityException)
              {
                  Console.WriteLine("Error: You don't have the required permission.");
                  debugTable.persist("Error: You don't have the required permission.");
              }
              else if (e is ArgumentException)
              {
                  Console.WriteLine("Error: Invalid values in the store.");
                  debugTable.persist("Error: Invalid values in the store.");
              }
              else
              {
                  debugTable.persist("Something got wrong with certificate");
                  return null;
              }
          }
  
          // Find the certificate that matches the thumbprint.
          X509Certificate2Collection certCollection = certStore.Certificates.Find(X509FindType.FindByThumbprint, certThumbprint, false);
          certStore.Close();
  
          // Check to see if our certificate was added to the collection. If no, throw an error, if yes, create a certificate using it.
          if (0 == certCollection.Count)
          {
              Console.WriteLine("Error: No certificate found containing thumbprint " + certThumbprint);
              debugTable.persist("Error: No certificate found containing thumbprint " + certThumbprint);
              return null;
          }
  
          debugTable.persist("found cert");
          // Create an X509Certificate2 object using our matching certificate.
          X509Certificate2 certificate = certCollection[0];
          return certificate;
      }
  </code></pre>
  
  <p>The debugtable.persists() method writes the debug message into a table storage.
  At the end I only find these entries in my table:</p>
  
  <pre><code>"Error: No certificate found containing thumbprint " + certThumbprint
  </code></pre>
  
  <p>So whats wrong with my code?</p>