How to show all service accounts

Service accounts are used by applications or services to interact with other systems or resources, often with specific permissions and credentials. They facilitate automation, enhance security, and enable seamless integration between different components of a system or platform.

To show all service accounts on a specific platform within a system, we need to follow the relevant steps based on the platform. Here are instructions for a few common platforms:

Google Cloud Platform (GCP)

Google Cloud Platform offers various ways to manage service accounts, including the Cloud console and Cloud SDK (command-line tool). We'll use both to demonstrate how to list all service accounts in a GCP project.

Using the GCP console

  1. Go to the GCP consolehttps://console.cloud.google.com/.

  2. Select the desired project.

  3. Open the "IAM & Admin" menu.

  4. Click on "Service accounts" to view a list of all service accounts in the project.

Here's the visual representation of all the mentioned steps:

Go to the GCP console
1 of 4

Using the Cloud SDK

  • If the Cloud SDK isn't installed, download it from the official documentationhttps://cloud.google.com/sdk/docs/install and set it up on the local machine.

  • Authenticate with Google Cloud by running the following command and following the instructions to log in:

gcloud auth login
Command to authenticate with Google Cloud
  • Run the following command to list all service accounts in the currently selected GCP project:

gcloud iam service-accounts list
Command to list all service accounts

Amazon Web Services (AWS)

In AWS, service accounts are called IAM (identity and access management) roles. We can list IAM roles using the AWS Management Console or the AWS CLI.

Using the AWS management console

  1. Go to the AWS Management Consolehttps://console.aws.amazon.com/ and log in using the AWS account credentials.

  2. From the AWS Management Console dashboard, search for "IAM" in the services search bar, and click on "IAM" to open the IAM dashboard.

  3. Click on "Roles" in the left sidebar.

  4. Filter the roles by the "Service" type to view all service accounts.

Here's the visual representation of all the mentioned steps:

Go to the AWS Management Console and log in
1 of 5

Using the AWS CLI

  • If AWS CLI isn't installed, follow the installation instructions herehttps://learn.microsoft.com/en-us/cli/azure/install-azure-cli.

  • After installation, configure it with the AWS credentials using the following command:

aws configure
Command to cofigure with AWS credentials
  • To list all IAM roles (service accounts) in the AWS account, run the following command:

aws iam list-roles
Commad to list all IAM roles

This command will display JSON-formatted output containing details about each IAM role, including its name, ARN (Amazon Resource Name), and associated policies.

Microsoft Azure

In Microsoft Azure, there are three service accounts native to Azure Active Directory: Managed identities, service principals, and user-based service accounts. We will use Azure Portal and Azure CLI to demonstrate how to list all these.

Using the Azure portal

  1. Go to the Azure Portalhttps://portal.azure.com/ and log in to the account.

  2. From the Azure Portal dashboard, search for "Azure Active Directory" in the services search bar, and click on "Azure Active Directory" to open the Azure AD dashboard.

  3. Managed identities: On the Azure AD dashboard, click on "Enterprise applications" in the left sidebar and then filter the applications by the "Managed Identities" category to view all service accounts.

  4. Service principals: On the Azure AD dashboard, click on "App registrations" in the left sidebar. All service principals (app registrations) created in the directory will be listed.

  5. User-based service accounts: On the Azure AD dashboard, click "Users" in the left sidebar. All user accounts will be listed here, including user-based service accounts.

Here's the visual representation of all the mentioned steps:

Go to the Azure Portal and log in to the account
1 of 6

Using Azure CLI

  • If Azure CLI isn't installed, follow the installation instructions herehttps://learn.microsoft.com/en-us/cli/azure/install-azure-cli.

  • Sign in to the Azure account by running the following command:

az login
Command to sign in to the Azure account
  • Managed Identities: To list all managed identities (service accounts) in the Azure subscription, use the following command:

az identity list
Command to list all managed identities
  • Service principals: To list all Service Principals, we can use the following command:

az ad sp list
Command to list all service principals
  • User-based service accounts: User-based service accounts are essentially Azure AD users. To list all users, we can use the following command:

az ad user list
Command to list user-based service accounts

Conclusion

In conclusion, efficiently managing service accounts across cloud providers (GCP, AWS, and Azure) is essential for maintaining a secure and organized cloud infrastructure. Utilizing the portals and command-line interfaces provided by each platform allows for easy access and control over these service accounts, promoting best practices in cloud security and access management.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved