Score:2

GCP: Can I list permissions assigned to custom role using gcloud?

uz flag

Is there any way to list the permissions associated with a (custom) role in Google Cloud Platform IAM using gcloud? I can find how to list the roles, but not the permissions associated with a given role.

Score:2
cn flag

You can list the permissions associated with a role using this command. Replace the role name with your custom role name.

gcloud iam roles describe roles/editor

Documentation: gcloud iam roles describe

in flag
This does not seem to work with the custom roles. The error is as follows `ERROR: (gcloud.beta.iam.roles.describe) Invalid value for [ROLE_ID]: The role id that starts with 'roles/' only stands for curated role. Should not specify the project or organization for curated roles`
John Hanley avatar
cn flag
@noob - What command are you running? The command in my answer is correct. If you mean that you created a custom role, then use the custom role name instead of `roles/editor`
in flag
This is the command I am using - `gcloud iam roles describe roles/CustomRole --project=my-project` this works for the curated roles, but not for the custom roles for me.
John Hanley avatar
cn flag
@Remove `roles/` and use the custom role name. You will need to look up the role ID and use the last part as in **MyCustomRole43**. In my answer `roles/editor` is the role name, the `roles` portion is not part of a custom role except when specifying the full role ID. You will also need to specify the project for custom roles as they are project specific. All of this is documented.
in flag
Thanks, removing the `roles/` prefix worked.
Score:1
je flag

for predefined role: gcloud iam roles describe roles/[roleid]

for custom role: gcloud iam roles describe [roleid] --project=[projectid]

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.