It took me about 2 hours to track the problem
The problem is how Azure deals with certificates.
Changing the following line
var certificate = new X509Certificate2(KeyFilePath, "notasecret", X509KeyStorageFlags.Exportable);
to that
var certificate = new X509Certificate2(KeyFilePath, "notasecret", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable);
The web application and service account now run on Azure. Hope this helps someone in the future.
source share