We have Azure Web App service, which is configured to have a custom domain say "https://test.contosa.com". I'm using the below code in my web app to retrieve the certificate from store.
using (X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser))
{
certStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certCollection = certStore.Certificates.Find(
X509FindType.FindByThumbprint,
"<<MY_CERTIFICATE_THUMBPRINT>>",
false);
X509Certificate2 certificate = certCollection.OfType<X509Certificate2>().FirstOrDefault();
if (certificate != null)
{
// Using the certificate here for generating and reading token
}
}
Now when I use the web app url "http://test.azurewebsites.net", I can able to fetch the certificates.
We have added the certificate binding for the custom domain based on the this link.
But when I use the custom domain "https://test.contosa.com", it's unable to find the certificate from store. How to search the certificate for custom domain?. Thanks in advance.