gcloud auth activate-service-account --key-file=key.json

Category: Google Cloud & Workspace

gcloud auth activate-service-account --key-file=key.json

Activate a service account from a key file

Makes gcloud act as a service account instead of a personal login, reading its private key from a JSON file downloaded from IAM. Service accounts are non-human identities meant for automation and CI pipelines. Generate the key file with gcloud iam service-accounts keys create, then confirm the switch with gcloud auth list.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.