Azure / Azure/azure-functions-host
Consumption plan azure functions certificate not found issue
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
Hi,
I am facing an issue when trying to access a certificate in consumption plan function app. I have uploaded the certificate from SSL tab. and added the setting WEBSITE_LOAD_CERTIFICATES = * in Application settings. But still getting error that certificate with thumbprint is not found. The same code is working in local.
this is the code i am using in Function app to get certificate , I have made isvalid to false, tried to access it from LocalStore and current user but getting same certificate not found error -
```
public static object GetCertificate(string thumbPrint)
{
X509Store store = null;
try
{
store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly);
var certs = store.Certificates.Find(X509FindType.FindByThumbprint, thumbPrint, true);
if (certs.Count == 1)
{
var cert = certs[0];
return cert;
}
else
{
throw new Exception($"Certificate with thumbprint {thumbPrint} not found");
}
}
finally
{
if (store != null)
store.Close();
}
}
```
Can you please let me know what i am missing
Contributor guide
Assessment
This issue has not been assessed yet.