This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to retrieve GCP IAM roles, users and serviceaccounts | |
# Author - Rajathithan Rajasekar - 03/03/2020 | |
# Update - 07/12/2023 | |
gcloud config set accessibility/screen_reader False | |
echo 'project-name,roles/rolename,user:username-and-serviceaccounts' > iamlist.csv | |
prjs=( $(gcloud projects list | tail -n +2 | awk {'print $1'}) ) | |
for i in "${prjs[@]}" | |
do | |
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" |