Straight after I published an APS.Net Core App via Visual Studio 2019 it crashes in the Azure Linux container with the error:
"2021-07-28T15:57:17.117335100Z [41m [1m [37mcrit [39m [22m [49m: Microsoft.AspNetCore.Hosting.Diagnostics[6]2021-07-28T15:57:17.117356202Z Application startup exception2021-07-28T15:57:17.117359902Z System.InvalidOperationException: Couldn't find a valid certificate with subject 'CN=MyCertName' on the 'CurrentUser\My'"
I have followed that example https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-5.0#example-deploy-to-a-non-azure-web-hosting-provider where I generated my own self-signed .pfx certificate using power-shell. I have uploaded the certificate to azure as shown here https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-5.0#example-deploy-to-a-non-azure-web-hosting-provider
I am also certain that my certificate has the right subject and store location. I also closely followed this video. https://www.eugenechiang.com/2021/01/12/setting-up-certificate-for-identityserver4-in-azure-app-service/ which overlaps with the microsoft docs, but still having the error after publishing my APS.Net Core app with appsettings.json file containing
"IdentityServer": {
"Key": {
"Type": "Store",
"StoreName": "My",
"StoreLocation": "CurrentUser",
"Name": "CN=MyCertName"
},
"Clients": {
"MyApp": {
"Profile": "IdentityServerSPA"
}
}
},
Does anyone know what might be causing the issue?