- gcloud alpha auth activate-service-account - authorize access to Google Cloud Platform with a service account
gcloud alpha auth activate-service-account [ACCOUNT] --key-file=KEY_FILE [--password-file=PASSWORD_FILE | --prompt-for-password] [GCLOUD_WIDE_FLAG ...]
(ALPHA) To allow gcloud (and other tools in Cloud SDK) to use
For more information on authorization and credential types, see: cloud.google.com/sdk/docs/authorizing
To obtain the key file for this command, use either the Google Cloud Platform Console (console.cloud.google.com or gcloud iam service-accounts keys create. The key file can be .json (preferred) or .p12 (legacy) format. In the case of legacy .p12 files, a separate password might be required and is displayed in the Console when you create the key.
Credentials will also be activated (similar to running gcloud config set account [ACCOUNT_NAME]).
If a project is specified using the --project flag, the project is set in active configuration, which is the same as running gcloud config set project [PROJECT_NAME]. Any previously active credentials, will be retained (though no longer default) and can be displayed by running gcloud auth list.
If you want to delete previous credentials, see gcloud auth revoke.
Note: Service accounts use client quotas for tracking usage.
E-mail address of the service account.
Path to the private key file.
At most one of these may be specified:
Path to a file containing the password for the service account private key (only
for a .p12 file).
Prompt for the password for the service account private key (only for a .p12
- At most one of these may be specified:
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
To authorize gcloud to access Google Cloud Platform using an existing service account while also specifying a project, run:
$ gcloud alpha auth activate-service-account \
This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you will have to apply for early access and have your projects registered on the API whitelist to use it. To do so, contact Support at cloud.google.com/support These variants are also available:
- $ gcloud auth activate-service-account $ gcloud beta auth activate-service-account