kevin
kevin

Reputation: 467

How to use certificate in Azure worker role?

I can't figure this out. I've uploaded my cert to the role I need to use it from.

This works great from my machine, but it doesn't seem to work the Worker Role, while it's running.

I was having problems locally until I "Installed" this certificate - do I have to do that with Azure?

Any tips? Thanks!

string certThumbprint = "8B6F1E6FEC6EB1D2EA8E86F78BD0841310BFD1F8";
X509Store certificateStore = new X509Store(StoreName.My, StoreLocation.LocalMachine);
certificateStore.Open(OpenFlags.ReadOnly);
var certs = certificateStore.Certificates.Find(
                    X509FindType.FindByThumbprint,
                    certThumbprint, false);

if (certs.Count == 0)
{
    Console.WriteLine("Couldn't find the certificate with thumbprint:" + certThumbprint);
    return;
}

Upvotes: 0

Views: 819

Answers (1)

Igorek
Igorek

Reputation: 15850

A few helpful pointers:

  • Make sure you're running in elevated mode.
  • Make sure that the certificate has been uploaded to the LocalMachine\Personal store, not CurrentUser\Personal store.
  • Make sure that you've uploaded the .PFX file to the necessary Role, not .CER file to management certificates area. (You can remote into the instance to make sure that the cert is in the proper place)

Upvotes: 2

Related Questions