0

I know I can list all users and their roles at the project level using:
gcloud projects get-iam-policy <project-id>
or gcloud projects get-ancestors-iam-policy <project-id>

See also:
How do I list all IAM users for my Google Cloud Project

But some permissions / roles can be set at the dataset or table level.
These users do not appear when i use: gcloud projects get-iam-policy <project-id>

How can I see ALL users and their roles/permissions, also the ones that only have access to a specific dataset and nothing else.

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96

1 Answers1

1

This is a helpful answer:
How to list all permissions granted to a specific principal on GCP?

After enabling the Cloud Asset API, you can do:
gcloud asset search-all-iam-policies --scope=projects/<project> --query="policy:<email>"

This shows for every asset / resource the policy and bindings, example:

assetType: bigquery.googleapis.com/Table
policy:
  bindings:
  - members:
    - user:your_user_email
    role: roles/bigquery.dataViewer
project: projects/7109387143
resource: //bigquery.googleapis.com/projects/your_project/datasets/dataset_name/tables/table_name

Documentation can be found here:
https://cloud.google.com/sdk/gcloud/reference/asset/search-all-iam-policies

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96