While Creating Service Account for Google BigQuery, There are two key file type. 1. P12 Key File 2. JSON Key File.
I can able to connect Google BigQuery with Service Account Credentials using P12 Key File by using following code.
String serviceAccountEmail = "XXXX@developer.gserviceaccount.com";
var certificate = new X509Certificate2(@"FileName.p12", "Secret Key", X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { BigqueryService.Scope.Bigquery, BigqueryService.Scope.BigqueryInsertdata, BigqueryService.Scope.CloudPlatform, BigqueryService.Scope.DevstorageFullControl }
}.FromCertificate(certificate));
BigqueryService Service = new BigqueryService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "PROJECT NAME"
});
Now i am trying to connect Service Account Credentials using JSON file type, but i could not get the proper syntax for creating.
How can we connect Google BigQuery with Service Account Credentials using JSON File?
Thanks,