Using Console
Using CLI
gcloud
command to list all service accounts in your project:
gcloud
command to revoke the unnecessary roles from the service account:
PROJECT_ID
with your project ID, SERVICE_ACCOUNT_EMAIL
with the email address of the service account, and ROLE
with the unnecessary role you want to revoke.gcloud
command to grant the minimum required roles to the service account:
PROJECT_ID
with your project ID, SERVICE_ACCOUNT_EMAIL
with the email address of the service account, and ROLE
with the minimum required role.gcloud
command to verify the updated IAM policy for the service account:
PROJECT_ID
with your project ID.Using Python