List IAM roles by member

Check who has which role; --flatten turns nested bindings into one row per member.

gcloud projects get-iam-policy <id> --flatten="bindings[].members" --format="table(bindings.role,bindings.members)"

tool
gcloud8 commands
tags
gcloudsecuritycloud

More gcloud commands

  • gcloud logging read 'severity>=ERROR' --limit 20 --freshness=1h --format='value(timestamp,resource.type,textPayload)'

    Get errors from the last hour across the project; --freshness keeps the query from scanning old logs.

  • gcloud compute ssh <name> --zone <id> --tunnel-through-iap

    Reach a VM without a public IP through Identity-Aware Proxy, no bastion host needed.

  • gcloud secrets versions access latest --secret=<name> --project <id>

    Print the latest Secret Manager version to stdout; in CI, pin a specific version so builds are repeatable.

  • gcloud storage rsync -r -d ./build gs://<name>/site

    Mirror a local folder to GCS, -d deletes extra files in the bucket; this is the newer replacement for gsutil rsync.

  • gcloud auth activate-service-account --key-file=key.json && gcloud config set project <id>

    Log in as a service account in CI and set the project; workload identity is safer than long-lived key files.

all 8 gcloud commands