google-cloud-platformgcloudgoogle-cloud-iam

suppress bindings output from gcloud projects add-iam-policy-binding command


When we execute gcp project add-iam-policy-binding, it returns a very verbose output of current bindings. Sometimes, there could be more than 15-20 bindings.

Is there a way to suppress the output to only success or failure?

I tried to use the --verbose flag with value error. It did not help.

Command:

gcloud projects add-iam-policy-binding <gcp_project_id> --member=serviceAccount:<service_account_id> --role <role_name>

Output:

Updated IAM policy for project [<gcp_project_id>].
bindings:
<all existing bindings>

Any help would be much appreciated.


Solution

  • Try to use "--no-user-output-enabled"

    reference https://fig.io/manual/gcloud/projects/add-iam-policy-binding