如何在Google Cloud Function中使用GCP服务帐户?

时间:2019-04-14 01:28:25

标签: google-cloud-platform google-cloud-functions

我有一个具有域范围权限的Google Cloud Platform服务帐户。我可以从终端将其添加到Google Analytics API调用中,并且可以正常运行。但是,我想运行与Google Cloud Function相同的脚本,并在GCP中引用服务帐户,而不必在存储库中或GCP以外的任何位置包含client_secret_service_account.json文件(如下所示)。有可能吗?

KEY_FILE_LOCATION = 'client_secret_service_account.json'

1 个答案:

答案 0 :(得分:1)

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