Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@grant
Last active August 1, 2020 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grant/b19e63aa330c351e66df285e363dc83b to your computer and use it in GitHub Desktop.
Save grant/b19e63aa330c351e66df285e363dc83b to your computer and use it in GitHub Desktop.
Create a Service Account
# Get the current project
PROJECT=$(gcloud config get-value core/project 2> /dev/null)
# Create a service account (aka robot account)
gcloud iam service-accounts create sa-name \
--description="sa-description" \
--display-name="sa-display-name"
# Create and download credentials for the service account
gcloud iam service-accounts keys create creds.json \
--iam-account sa-name@$PROJECT.iam.gserviceaccount.com
# Copy service account email
echo "sa-name@$PROJECT.iam.gserviceaccount.com" | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment