Hi, to better manage our infrastructure we'd like to set up a CSV report to list all resources in our projects and which members and roles have access to them.
I know I can create a CSV list with all members and roles within a project with the following command:
gcloud asset search-all-iam-policies --scope=projects/my-project --flatten='policy.bindings' --format='csv(policy.bindings.members, policy.bindings.role)'
However my question is, how can I add the corresponding resource and assettype to each line?
Thanks
Solved! Go to Solution.
After poking a bit around it looks like I found the solution myself. The following command provides the output I was looking for:
gcloud asset search-all-iam-policies --scope=projects/my-project --flatten='policy.bindings[].members[]' --format='csv(resource, assetType, policy.bindings.members, policy.bindings.role)'
After poking a bit around it looks like I found the solution myself. The following command provides the output I was looking for:
gcloud asset search-all-iam-policies --scope=projects/my-project --flatten='policy.bindings[].members[]' --format='csv(resource, assetType, policy.bindings.members, policy.bindings.role)'