Create a service account in the Google Cloud Platform using the command line:

mitul3737

Shahriyar Al Mustakim Mitul

Posted on October 8, 2022

Create a service account in the Google Cloud Platform using the command line:

Use this command to create the service account:

gcloud iam service-accounts create test-service-account2 --display-name "test-service-account2"
Enter fullscreen mode Exit fullscreen mode

Note: If you see the following output, type y and press ENTER

Image description

Now if you go to the Navigation bar and then IAM & Admin and then Service accounts, you can see out service account:

Image description

Also we can give it a role using command line. For example, lets give this service account the project viewer role:

gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT --member serviceAccount:test-service-account2@${GOOGLE_CLOUD_PROJECT}.iam.gserviceaccount.com --role roles/viewer
Enter fullscreen mode Exit fullscreen mode

Image description

Done!

💖 đŸ’Ē 🙅 🚩
mitul3737
Shahriyar Al Mustakim Mitul

Posted on October 8, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related