Certificate not found in Azure Web App

I deployed the web application as a web application in Azure App Service. I have uploaded several certificates to Azure Portal since the web application is running over SSL and we are using a different certificate to perform some decryption.

In the latter case, I have a method (which works fine locally) to find the certificate:

public static X509Certificate2 FindCertificate(KnownCertificate certificate) { return FindCertificate(StoreName.My, StoreLocation.CurrentUser, X509FindType.FindByThumbprint, certificate.Thumbprint); } 

But I get an error that the certificate with the XYZ fingerprint was not found. Although, he is present on the Cote d'Azur. (I downloaded and imported it)

I am using StoreLocation.CurrentUser as suggested in THIS POST , but it still does not work. Am I using the wrong store or what else am I missing?

EDIT: I was able to remotely debug my WebApp using the ImmediateWindow VisualStudio function as well. I executed this code

 new X509Store(StoreName.CertificateAuthority, StoreLocation.CurrentUser).Certificates.Find(findType, findValue, false).Count; 

testing all possible combinations of StoreNames and StoreLocations, but to no avail.

Is it possible, as indicated here , that in order to use the certificate for purposes other than https traffic, you need a cloud service and that (I believe) the App services do not support it?

+5
source share
1 answer

You need to add WEBSITE_LOAD_CERTIFICATES to the application settings for your web application. Set the value to either "*" or the thumbprint of your certificate that you want to upload to the web application environment. My personal preference is to set this value to "*", which means to upload all downloaded certificates.

enter image description here

After applying this change, you can download your certificate from your web application code.

More information on using certificates is available here . The article is a bit outdated (in today's standards), but still relevant.

+9
source

All Articles