0
votes

I have created a WebJob in .Net Framework 4.5. This webjob is consuming a traditional WCF service which is protected by certificates ( Public/private key ). I have imported all the required certificates in my local computer and I was able to communicate with the WCF service. Below is sample code that is fetching certificate from local store.

 X509Certificate2 tlsCert = X509CertificateUtil.GetCertificate(
            "39834391cba4e625bab0cba7838247ec6b53d92d",
            X509FindType.FindByThumbprint,
            StoreName.TrustedPeople,
            StoreLocation.LocalMachine,
            true
            );

and then use tlsCert further to execute WCF contract.

I am not sure how to do this when I am hosting this in Azure. How do I import the certificate and access certificate store in Azure?
Note: We are not using VM to deploy WebJob in azure. we are using 'Appservice' plan to host the webjob.

Any direction how to deal with the certificates? I am trying to get it done using KeyVault, but not sure if it will work or not.

1

1 Answers

1
votes

In Azure KeyVault, certificates can be imported in either PFX or PEM format, so the formats you mentioned won't work unless you convert them to PEM or PFX.

Here are some instructions for how to do that.

See more information about importing KeyVault certificates here.