How to Create a GCP Service Account for use with Google Drive

Approximate time to complete: 5-7 minutes, excluding prerequisites

This how to article gives you step-by-step instructions for creating a Google Drive service account with credentials in Google Cloud Platform. It will also show you how to configure a source connector from Vectorize to Google Drive as part of a RAG pipeline.

Before you begin

Before starting, ensure you have access to the credentials, connection parameters, and API keys as appropriate for the following:

Enable the Google Drive API

  1. Open Google Cloud Console

    • Navigate to the Google Cloud Console.

    • Make sure you are working in the correct project.

  2. Go to APIs & Services

    • From the dashboard, locate the "APIs & Services" option in the quick access section.

    • Click on APIs & Services.

  3. Enable Cloud Storage API

    • Click on ENABLE APIS AND SERVICES.

    • In the API library, use the search box and type Google Drive to locate the API.

    • From the search results, click on the Google Drive option from Google Enterprise API.

    • On the Google Drive API details page, click ENABLE.

    • If the API is already enabled, you can go to the next step.

Set Up the Service Account

  1. Navigate to APIs & Services > Credentials.

  1. Click CREATE CREDENTIALS, then click Service account.

  1. Fill in your service details

  • Provide a Service account name, this will automatically populate the Service account ID field as well

  • Click on CREATE AND CONTINUE, making sure you're clicking the button shown and NOT the more prominent DONE button.

  1. Assign roles to your service account

  • In the role selection section, grant the Project > Viewer role for the service account.

  1. Finalizing the Service Account

    • To finalize the setup, click DONE to complete the creation of the service account.

Step 4: Create Keys for the Service Account

  1. Select the Service Account

    • After creating the service account, you should see a list with the new service account listed.

    • If you left that page, you can always get to it by going to IAM & Admin > Service Accounts using upper left "hamburger" menu.

    • Click on the service account email to manage it.

  2. Go to the Keys Tab

    • Once in the service account details, navigate to the KEYS tab.

  3. Add a New Key

    • Open the ADD KEY dropdown

  4. Select Create new key to generate a new key for this service account.

  5. Create a JSON Key

    • When prompted, select the JSON key type and click CREATE.

  6. Save the Key

    • A JSON file will be downloaded. Save this file securely as it contains the private key for your service account.

    • Make sure to keep this key file secure, as it cannot be recovered if lost.

Last updated