I have an Azure FunctionApp (Dotnet Isolated 7.0) running on a Linux app service plan. I also have a certificate configured within the app, stored in a keyvault. WEBSITE_LOAD_CERTIFICATES is configured in the app settings, with the thumbprint of my certificate.
When running the app, I can access the certificate at this location: /var/ssl/private/[thumbprint].p12
I'm also using IBM MQ, which expects to be able to load a certificate from X509Store(StoreName.My, StoreLocation.CurrentUser)
.
My question is this: how can I make sure the configured certificate is available from the CurrentUser
location?
I have tried to open the certificate and load it into the store, using the following code:
using var bytes = new X509Certificate2($"/var/ssl/private/{thumbprint}.p12");
using var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadWrite);
store.Add(bytes);
But I get this exception:
The owner of '/home/.dotnet/corefx/cryptography/x509stores/my' is not the current user.