Is there a way to import a certificate into the Personal store of the ApplicationPool identity in Windows?
The problem started from the way Azure websites make use of imported certificates. As correctly explained in this blog post - https://azure.microsoft.com/blog/2014/10/27/using-certificates-in-azure-websites-applications/ - for Azure websites the certificates will be installed to the Personal certificate store of the ApplicationPool Identity of the worker process.
The certificate is then accessed in the following way:
X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
We are deploying the same code on-premise as well as on Azure, so we need a way to replicate this behavior on our Windows Server 2012R2.