1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-13 16:37:00 +00:00
gcloud-help/gcloud/beta/auth/login
2022-03-16 08:47:18 +00:00

112 lines
4.3 KiB
Bash

NAME
gcloud beta auth login - authorize gcloud to access the Cloud Platform with
Google user credentials
SYNOPSIS
gcloud beta auth login [ACCOUNT] [--no-activate] [--brief] [--no-browser]
[--cred-file=CRED_FILE] [--enable-gdrive-access] [--force]
[--no-launch-browser] [--update-adc] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) Obtains access credentials for your user account via a web-based
authorization flow. When this command completes successfully, it sets the
active account in the current configuration to the account specified. If no
configuration exists, it creates a configuration named default.
If valid credentials for an account are already available from a prior
authorization, the account is set to active without rerunning the flow.
Use gcloud auth list to view credentialed accounts.
If you'd rather authorize without a web browser but still interact with the
command line, use the --no-browser flag. To authorize without a web browser
and non-interactively, create a service account with the appropriate scopes
using the Google Cloud Console (https://console.cloud.google.com) and use
gcloud auth activate-service-account with the corresponding JSON key file.
In addition to Google user credentials, authorization using workload
identity federation or service account keys is also supported.
For authorization with external accounts (workload identity pools) or
service accounts, the --cred-file flag must be specified with the path to
the workload identity credential configuration file or service account key
file (JSON). Login with workload identity federation is not yet supported
in other Google Cloud CLIs (e.g. gsutil and bq) and is only applicable to
gcloud commands. For more information on workload identity federation, see:
https://cloud.google.com/iam/docs/workload-identity-federation.
For more information on authorization and credential types, see:
https://cloud.google.com/sdk/docs/authorizing.
EXAMPLES
To obtain access credentials for your user account, run:
$ gcloud beta auth login
To obtain access credentials using workload identity federation, run:
$ gcloud beta auth login \
--cred-file=/path/to/workload/configuration/file
POSITIONAL ARGUMENTS
[ACCOUNT]
User account used for authorization.
FLAGS
--activate
Set the new account to active. Enabled by default, use --no-activate to
disable.
--brief
Minimal user output.
--no-browser
Use this flag to authenticate gcloud CLI on a machine without a web
browser.
--cred-file=CRED_FILE
Path to the external account configuration file (workload identity
pool, generated by the Cloud Console or gcloud iam
workload-identity-pools create-cred-config) or service account
credential key file (JSON).
--enable-gdrive-access
Enable Google Drive access.
--force
Re-run the web authorization flow even if the given account has valid
credentials.
--launch-browser
(DEPRECATED) Launch a browser for authorization. If not enabled or if
it is not possible to launch a browser, prints a URL to standard output
to be copied.
The --[no-]launch-browser flags are deprecated and will be removed in
version 383.0.0 (04/26/2022). Use --no-browser to replace
--no-launch-browser. Enabled by default, use --no-launch-browser to
disable.
--update-adc
Write the obtained credentials to the well-known location for
Application Default Credentials (ADC). Run $ gcloud auth
application-default --help to learn more about ADC. Any credentials
previously generated by gcloud auth application-default login will be
overwritten.
GCLOUD WIDE FLAGS
These flags are available to all commands: --access-token-file, --account,
--billing-project, --configuration, --flags-file, --flatten, --format,
--help, --impersonate-service-account, --log-http, --project, --quiet,
--trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
NOTES
This command is currently in beta and might change without notice. These
variants are also available:
$ gcloud auth login
$ gcloud alpha auth login