When deploying a blazor app that contains identityserver 4 to an azure app service, i get the following exception:
Exception Info: System.InvalidOperationException: There was an error loading the certificate. Either the password is incorrect or the process does not have permisions to store the key in the Keyset 'DefaultKeySet'
The certificate comes from azure keyvault and locally there are no issues. Below the code I use to call the cert and load it into the identityserver signingcredentials:
var pfx = Configuration["certname"];
var bytes = Convert.FromBase64String(pfx);
var certificate2Collection = new X509Certificate2Collection();
certificate2Collection.Import(bytes, null, X509KeyStorageFlags.UserKeySet);
services.AddIdentityServer()
.AddSigningCredential(certificate2Collection[0]);
Any thoughts on how to fix this?

