analyticsPierce
analyticsPierce

Reputation: 3025

How to use GCP service account in Google Cloud Function?

I have a Google Cloud Platform service account with domain-wide authority. I can add it to a Google Analytics API call from my terminal and it works correctly. However, I would like to run that same script as a Google Cloud Function and reference the service account in GCP without including the client_secret_service_account.json file (like below) in the repository or anywhere outside of GCP. Is that possible?

KEY_FILE_LOCATION = 'client_secret_service_account.json'

Upvotes: 1

Views: 3847

Answers (1)

manasouza
manasouza

Reputation: 1225

You can now reference the service account when deploying Cloud Functions. Check documentation for gcloud.

When using GCP console, expand "Advanced options" to inform the service account

Upvotes: 5

Related Questions