问题描述
我有一个具有域范围权限的Google Cloud Platform服务帐户.我可以从终端将其添加到Google Analytics API调用中,并且可以正常运行.但是,我想运行与Google Cloud Function相同的脚本,并在GCP中引用服务帐户,而不必在存储库中或GCP以外的任何位置包含client_secret_service_account.json文件(如下所示).有可能吗?
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'
推荐答案
您现在可以在部署Cloud Functions时引用服务帐户.查看 gcloud文档.
You can now reference the service account when deploying Cloud Functions. Check documentation for gcloud.
使用GCP控制台时,展开高级选项"以通知服务帐户
When using GCP console, expand "Advanced options" to inform the service account
这篇关于如何在Google Cloud Function中使用GCP服务帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!