title: How do I configure Google BigQuery command line tool to use a Service Account?
body: <p>I've created a service account using the Google API Console and wish to use this service account with the <a href="http://developers.google.com/bigquery/docs/cli_tool" rel="noreferrer">Google BigQuery CLI</a> (bq) tool.</p>
  
  <p>I've been using the command line tool to successfully access the BigQuery service using my valid OAuth2 credentials in ~/.bigquery.v2.token, however I can't seem to find any documentation on how to modify this file (or otherwise configure the tool) to use a service account instead.</p>
  
  <p>Here is my current .bigquery.v2.token file</p>
  
  <pre><code>{
      "_module": "oauth2client.client",
      "_class": "OAuth2Credentials",
      "access_token": "--my-access-token--",
      "token_uri": "https://accounts.google.com/o/oauth2/token",
      "invalid": false,
      "client_id": "--my-client-id--.apps.googleusercontent.com",
      "id_token": null,
      "client_secret": "--my-client-secret--",
      "token_expiry": "2012-11-06T15:57:12Z",
      "refresh_token": "--my-refresh-token--",
      "user_agent": "bq/2.0"
  }
  </code></pre>
  
  <p>My other file: ~/.bigqueryrc generally looks like this:</p>
  
  <pre><code>project_id = --my-project-id--
  credential_file = ~/.bigquery.v2.token
  </code></pre>
  
  <p>I've tried setting the credential_file paramater to the .p12 private key file for my service account but with no luck, it gives me back the following error</p>
  
  <pre><code>******************************************************************
  ** No OAuth2 credentials found, beginning authorization process **
  ******************************************************************
  </code></pre>
  
  <p>And asks me to go to a link in my browser to set up my OAuth2 credentials again.</p>
  
  <p>The command line tools' initial configuration option "init":</p>
  
  <pre><code>bq help init
  </code></pre>
  
  <p>displays no helpful information about how to set up this tool to use a service account.</p>