Back to controls

Ensure user-managed/external keys for service accounts are rotated every 90 days or less

Service Account keys consist of a key ID (Private_key_Id) and Private key, which are used to sign programmatic requests that you make to Google cloud services accessible to that particular Service account. It is recommended that all Service Account keys are regularly rotated.

Category

Controls

Medium

Applies to

Google Cloud

Coverage

1 queries

Asset types

1 covered

Overview

Service Account keys consist of a key ID (Private_key_Id) and Private key, which are used to sign programmatic requests that you make to Google cloud services accessible to that particular Service account. It is recommended that all Service Account keys are regularly rotated.

Rationale

Rotating Service Account keys will reduce the window of opportunity for an access key that is associated with a compromised or terminated account to be used. Service Account keys should be rotated to ensure that data cannot be accessed with an old key which might have been lost, cracked, or stolen.

Each service account is associated with a key pair, which is managed by Google Cloud Platform (GCP). It is used for service-to-service authentication within GCP. Google rotates the keys daily.

GCP provides option to create one or more user-managed (also called as external key pairs) key pairs for use from outside GCP (for example, for use with Application Default Credentials). When a new key pair is created, user is enforced download the private key (which is not retained by Google). With external keys, users are responsible for security of the private key and other management operations such as key rotation. External keys can be managed by the IAM API, gcloud command-line tool, or the Service Accounts page in the Google Cloud Platform Console. GCP facilitates up to 10 external service account keys per service account to facilitate key rotation.

Remediation guidance

From Console

Delete external (user managed) Service Account Key older than 90 days

  1. Go to APIs & Services\Credentials using https://console.cloud.google.com/apis/credentials
  2. In Section Service Account Keys, for every external (user managed) Service account key with creation date is more than or equal to past 90 days click Delete Bin Icon to Delete Service Account key

Create New external (user managed) Service Account Key for a Service Account

  1. Go to APIs & Services\Credentials using https://console.cloud.google.com/apis/credentials
  2. Click Create Credentials and Select Service Account Key
  3. Choose Service account in drop-down list for which External (user managed) Service Account key needs to be created
  4. Select desired key type format among JSON or P12
  5. Click Create. It will download private key. Keep it safe.
  6. Click Close if prompted
  7. It will redirect to APIs & Services\Credentials page. Make a note of New ID displayed in section Service account keys

Impact

Rotating service account key will break communication for depending applications. Dependent applications needs to configured manually with new key id displayed in section Service account keys and private key downloaded by user.

Default Value

GCP does not provides automation option for External (user managed) Service key rotation.

References:

  1. https://cloud.google.com/iam/docs/understanding-service-accounts#managing_service_account_keys
  2. https://cloud.google.com/sdk/gcloud/reference/iam/service-accounts/keys/list
  3. https://cloud.google.com/iam/docs/service-accounts

Notes

For user-managed Service Account key(s), key management is entirely users responsibility.

Service-wide remediation

Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.

Google Cloud

Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.

Operational rollout

  1. Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
  2. Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
  3. Re-scan and track approved exceptions with an owner and expiry date.

Query logic

These are the stored checks tied to this control.

User-managed/external keys for service accounts are rotated every 90 days or less

Connectors

Google Cloud

Covered asset types

IAMServiceAccountKey

Expected check: eq []

GCPIAM5{...AssetFragment}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon