title: Permissions For Google Cloud SQL Import Using Service Accounts
body: <p>I've exported MySQL Database following the <a href="https://cloud.google.com/sql/docs/mysql/import-export/exporting" rel="noreferrer">MySQL Export Guide</a> successfully. </p>
  
  <p>Now, I'm trying to import MySQL Database following the <a href="https://cloud.google.com/sql/docs/mysql/import-export/importing" rel="noreferrer">MySQL Import Guide</a>.</p>
  
  <p>I've checked the permissions for the <code>service_account_email</code> I'm using, and I have allowed both <strong>Admin SQL</strong> and <strong>Admin Storage</strong> permissions. </p>
  
  <p>I was able to successfully activate my service account using this command locally:</p>
  
  <pre><code>gcloud auth activate-service-account &lt;service_account_email&gt; --key-file=&lt;service_account_json_file&gt;  
  </code></pre>
  
  <p>After I ran the command:</p>
  
  <pre><code>gcloud sql import sql &lt;instance&gt; &lt;gstorage_file&gt; --database=&lt;db_name&gt; --async
  </code></pre>
  
  <p>I got this information:</p>
  
  <pre><code>{
    "error": {
      "errors": Array[1][
        {
          "domain": "global",
          "reason": "required",
          "message": "Login Required",
          "locationType": "header",
          "location": "Authorization"
        }
      ],
      "code": 401,
      "message": "Login Required"
    }
  }
  </code></pre>
  
  <p><strong>Other Things I've Tried</strong></p>
  
  <p>I also tried using the <code>service_account_email</code> of my SQL instance, which came from:</p>
  
  <pre><code>gcloud sql instances describe &lt;instance_name&gt;
  </code></pre>
  
  <p>But, it seems to have the same error.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Based on the REST API JSON error I'm given, how do I "login" using the <code>service_account_email</code> so I wouldn't get the <code>401 Error</code>?</p>