pkaramol
pkaramol

Reputation: 19342

Google Cloud Platform service account not getting permissions from organisation custom role

I have the following service account

[email protected]

Which seems to have the following custom role

▶ gcloud projects get-iam-policy my-project  \
--flatten="bindings[].members" \
--format='table(bindings.role)' \
--filter="bindings.members:[email protected]"
ROLE
organizations/123456789/roles/my_custom_role

This custom role has the following permissions

▶ gcloud iam roles describe my_custom_role --organization 123456789
description: My custom role
etag: kdkdkdkd=
includedPermissions:
- container.clusters.get
- container.clusters.list
- container.clusters.update
- container.nodes.delete
- container.nodes.list
- container.operations.get
- resourcemanager.projects.get
- resourcemanager.projects.list
name: organizations/123456789/roles/my_custom_role
stage: GA
title: my_custom_role-

However, when assuming this role (I create, download and login using a json private key)

and listing projects, I cannot see all the organisation's projects but rather only the project the SA belongs to, although I should, given that

Why is that?

Upvotes: 1

Views: 1025

Answers (2)

Joseph Lust
Joseph Lust

Reputation: 19985

To see other projects, you need a higher level permission on your org.

and listing projects, I cannot see all the organisation's projects but rather only the project the SA belongs to, although I should, given that

This is expected, because the project can only control who sees this project.

Upvotes: 1

Chaotic Pechan
Chaotic Pechan

Reputation: 966

You may need organization permissions too:

https://cloud.google.com/resource-manager/reference/rest/v1beta1/organizations/list

organizations.list

Upvotes: 1

Related Questions