Skip to content
Least Privilege Principle

Least privilege for service identities in Google Cloud means dedicated service accounts, no keys and no Editor role

Service identities in Google Cloud are service accounts and Google-managed service agents. Google's documentation, read 16 Nov 2026, says default service accounts can hold the Editor role and that service account keys are a security risk. This guide covers cutting them with the IAM recommender and usage tools.

Open the calculator ยท All guides

Service accounts, their keys and service agents are three different exposures

Google's service account guidance says some services, including Compute Engine and App Engine, create a default service account that has the Editor role (roles/editor) on the project by default. A resource created without a named service account can use it automatically. Google calls it very risky to share a powerful service account across multiple applications, and notes shared accounts make it hard to trace activity to the right application.

Service account keys are user-managed credentials. Google lists the main threats as credential leakage, privilege escalation, exposure of confidential metadata, non-repudiation and malicious credential configurations, and says the best mitigation is to avoid user-managed keys.

Service agents are Google-managed service accounts that let a service access your resources. Google says it creates them after you activate and use an API, and they appear in allow policies and audit logs. You do not create them, but you can see and review their roles.

Google's IAM guidance adds that anyone granted the Service Account User role on a service account can access all the resources that service account can access.

Recommender, usage views and lateral movement insights are the provider tools

Google's Policy Intelligence tools for service accounts include viewing recent usage for service accounts and keys, finding unused service accounts and finding service accounts with lateral movement permissions. Google recommends identifying and disabling unused service accounts, and disabling before deleting.

The IAM recommender covers service accounts through role recommendations built from the last 90 days of permission use. Google notes that role recommendations for service agents can include permissions to add, shown with a plus sign, which does not occur for other principals.

Lateral movement insights identify roles that let a service account in one project impersonate a service account in another, which Google says can create a chain of impersonations across projects.

Google provides an organization policy constraint, constraints/iam.automaticIamGrantsForDefaultServiceAccounts, which stops default service accounts in new projects from being automatically granted Editor. Google states that applying it does not remove Editor from existing default service accounts. The routes page covers what to do when provider tools alone do not finish the job.

Steps to bring service accounts to least privilege

  • Enforce the constraint that prevents automatic Editor grants for default service accounts, then list existing default service accounts that still hold roles/editor.
  • Create a dedicated service account per application, as Google advises, and attach it to the resource instead of the default account.
  • Remove Editor from default service accounts after granting the specific predefined roles each workload needs.
  • Use the recent usage view to find service accounts and keys with no use. Disable them, wait through a business cycle, then delete.
  • List user-managed keys. Replace each with attached service accounts, impersonation or workload identity federation, and disable the key before deleting it.
  • Review who holds Service Account User and Service Account Token Creator-type access on each service account, and limit it.
  • Apply IAM recommender suggestions for service accounts, and check lateral movement insights before cross-project permissions are removed.
  • Repeat on a schedule. See what least privilege access means for the method.

Roles and credentials to avoid on service accounts

Role or credentialDocumented reason (Google, read 16 Nov 2026)Use instead
roles/editor on a default service accountGoogle says default service accounts get Editor automatically and that sharing one across applications is very risky.A dedicated service account with predefined roles.
roles/ownerGoogle says it allows access to and modification of almost all resources and should be granted only when nearly universal access is required.A predefined role on the resource.
User-managed service account keysGoogle lists leakage, privilege escalation, exposure of confidential metadata, non-repudiation and malicious credential configuration as threats.Attached service accounts, impersonation or federation.
One service account shared across applicationsGoogle says it makes activity hard to trace to the right application.A service account per application.
Service Account User granted widelyGoogle says holders can access everything the service account can.Grant on the single service account, to specific principals.
Unused service accounts left enabledGoogle recommends identifying and disabling unused service accounts.Disable, then delete after verification.

Measure accounts, keys and the 90-day permission gap

Record per project: default service accounts with Editor, user-managed keys by age, service accounts with no recent use, and service accounts that other projects can impersonate. For each active service account, compare permissions in its roles with permissions used in the last 90 days, which is the recommender's window.

A key count that falls month on month is the clearest sign of progress, because every removed key removes a standing credential. Privilege creep shows why the default Editor grant outlives the project that created it.

Related guides: AWS service identities and Azure service identities.

Sources

  1. Google Cloud IAM: Best practices for using service accounts, read 16 Nov 2026
  2. Google Cloud IAM: Best practices for managing service account keys, read 16 Nov 2026
  3. Google Cloud IAM: Service accounts overview, read 16 Nov 2026
  4. Google Cloud IAM: Service agents, read 16 Nov 2026
  5. Google Cloud IAM: Role recommendations overview, read 16 Nov 2026
  6. Google Cloud IAM: Manage role recommendations, read 16 Nov 2026
  7. Google Cloud: Policy Intelligence overview, read 16 Nov 2026
  8. Google Cloud IAM: Best practices for using IAM securely, read 16 Nov 2026

Last reviewed 16 Nov 2026.