4

I'm making a voice recognition program, but I can't seem to be able to send a request to the Cloud. Whenever I try:

gcloud projects add-iam-policy-binding [PROJECT_ID] --member "serviceAccount:[SEVICE-ACCOUNT-NAME]@[PROJECT_ID].iam.gserviceaccount.com" --role "roles/owner"

I get this:

ERROR: (gcloud.projects.add-iam-policy-binding) INVALID_ARGUMENT: Request contains an invalid argument.

Can anybody help?

kynan
  • 13,235
  • 6
  • 79
  • 81
Rishy
  • 45
  • 1
  • 1
  • 7

3 Answers3

2

As specified in the documentation, you should write the command like:

gcloud projects add-iam-policy-binding YOUR_PROJECT_ID --member "serviceAccount:NAME@YOUR_PROJECT_ID.iam.gserviceaccount.com" --role "roles/owner"

This should work for you!

ericcco
  • 741
  • 3
  • 15
  • 1
    I was actually looking for something like: https://cloud.google.com/docs/authentication/getting-started – Rishy Sep 03 '19 at 12:44
  • Keep in mind that if you follow this quickstart, you should remove the symbol "[" and "]" when writing the command. This would be something like: `gcloud projects add-iam-policy-binding YOUR_PROJECT_ID --member "serviceAccount:NAME@YOUR_PROJECT_ID.iam.gserviceaccount.com" --role "roles/owner"` – ericcco Sep 03 '19 at 13:45
  • This isn't for a service account! – lizziepika Dec 14 '20 at 21:23
  • 1
    This was it for me. Seems like in this page: https://cloud.google.com/composer/docs/composer-2/create-environments#gcloud_2 there is a typo in that the first parameter which had me putting in the service account instead of the project id. It should be like this answer says! – user3274871 Oct 29 '22 at 06:54
0

It can be an issue of currently active environment config.

Please check it:

gcloud config configurations list

0

It's likely a wrong parameter as the output suggests.

Make sure you use the correct parameters as ericcco suggests. The project id is typically something like my-project-3473646 .

The command would then be something like:

gcloud projects add-iam-policy-binding my-project-3473646 --member "serviceAccount:SERVICE_ACCOUNT_NAME@my-project-3473646.iam.gserviceaccount.com" --role "roles/owner"

It helps if you upvote or mark as solved, it will help others, thank you.

Vincent Gerris
  • 7,228
  • 1
  • 24
  • 22