I'm trying to authenticate in a bash script and enable my service account and I have cred.json
. Here is what I tried:
gcloud auth activate-service-account --key-file=/etc/gcp-cred.json
The problem is that I have to set project explicitly:
gcloud config set project my_proj
Which is kind of redundant because gcp-cred.json
contains this project already as a field:
"project_id": "my_proj"
Is there a way to avoid doing gcloud config set project
explicitly and set it with gcp-cred.json
?