When trying to deploy a web application to Azure using a service account with the Google .net client library it is returning with the following error
502 - Web server received an invalid response while acting as a gateway or proxy server.
Code example:
var certificate = new X509Certificate2(KeyFilePath, "notasecret", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail) {
Scopes = new string[] { AnalyticsService.Scope.Analytics };
}.FromCertificate(certificate));
// Create the service.
AnalyticsService service = new AnalyticsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Analytics API Sample",
});
The code above works when run in development. However when deployed to AZURE it returns an error.