Google cloud How to list all service-accounts from all Projects in GCP

0 votes

I need to obtain every property of a service account in the Google Cloud. Is it feasible to list every property using a selector like *?

Otherwise, I need to know the following:

Name of the SA account Email address
I have a role.
User controlled Account creation date, last use date, and time of authentication. Keys (if any).
Account status (enabled or disabled): Project name
I am able to obtain all of the projects and service accounts within it, but I am unsure of how to obtain the additional values.

foreach ($project in gcloud projects list --format="value(projectId)")
{
  Write-Host "ProjectId: $project"
  foreach ($robot in  gcloud iam service-accounts list --project $project --format="value(email)")
  {
     Write-Host "    -> Robot $robot"
   
  }
}
Nov 9, 2022 in GCP by Ashwini
• 5,390 points
771 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In GCP

0 votes
1 answer

Google cloud: How to list all service-accounts from all Projects in GCP

Your code sample suggests you want the ...READ MORE

answered Mar 14, 2022 in GCP by Korak
• 5,820 points
3,268 views
+2 votes
1 answer

How to list down all the projects in GCP Cloud?

Hi@akhtar, GCP Shell has a command named gcloud. ...READ MORE

answered Aug 23, 2020 in GCP by MD
• 95,440 points
3,262 views
0 votes
1 answer

What are the service accounts in GCP? How to create one?

The special accounts associated with a project are called the Service Accounts. The ...READ MORE

answered Oct 9, 2019 in GCP by Sirajul
• 59,250 points
567 views
0 votes
1 answer

Google Cloud Platform: Logging in to GCP from command line

You have a couple of options here ...READ MORE

answered Apr 6, 2022 in GCP by Korak
• 5,820 points
857 views
0 votes
0 answers

How to test a Cloud Function in Google Cloud Platform (GCP)?

I've been looking everywhere for the answer ...READ MORE

Nov 9, 2022 in GCP by Ashwini
• 5,390 points
189 views
0 votes
1 answer

How to change the project in GCP using CLI commands?

gcloud config set project $MY_PROJECT_ID #=> Updated property [core/project]. You ...READ MORE

answered Nov 4, 2022 in GCP by Tejashwini
• 3,780 points
691 views
0 votes
1 answer

Using the Google Cloud Platform SDK CLI to List all Active Resources Under a Given Project

For a specific organization, folder, or project, ...READ MORE

answered Nov 7, 2022 in GCP by Tejashwini
• 3,780 points
419 views
0 votes
1 answer

Understanding GCP IAM between multiple projects

Roles set on one project cannot be ...READ MORE

answered Nov 7, 2022 in GCP by Tejashwini
• 3,780 points
774 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP