Last active
August 1, 2020 02:01
-
-
Save grant/b19e63aa330c351e66df285e363dc83b to your computer and use it in GitHub Desktop.
Create a Service Account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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