Use this command to create the service account:
gcloud iam service-accounts create test-service-account2 --display-name "test-service-account2"
Note: If you see the following output, type y and press ENTER
Now if you go to the Navigation bar and then IAM & Admin and then Service accounts, you can see out service account:
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
Done!
Top comments (0)