Service account

Also known as: bot account

On this page 6

A service account is a non-human identity that an application, script, integration or automated workflow uses to authenticate to other systems and act within a defined set of permissions. In automation security, it separates what a machine process is allowed to do from the personal accounts of the people who built or operate that process.

Service accounts exist in almost every environment under different names: Windows service and managed service accounts in Active Directory, system accounts on Linux, service accounts in Kubernetes and public cloud platforms, and workload identities issued by identity providers. Because they run unattended, often with broad access and long-lived credentials, they are among the most attractive targets for attackers and one of the most frequently neglected identity types.

How a service account authenticates and acts

A service account works like any other identity: it proves who it is with a credential, receives permissions through roles or group memberships, and every action it performs is logged under its name. The difference is that no person is present at login, so the credential must be available to the process automatically and no interactive factor such as a phone prompt can be used.

This is why the choice of credential type defines the security of a service account more than any other decision. The table compares the common options from weakest to strongest.

Credential typeTypical lifetimeMain riskSecurity level
Static passwordMonths to yearsReuse, leakage, no rotationLow
Static API keyUntil revokedExposure in code or logsLow
Downloaded private key fileOften unlimited by defaultCopied keys outside the vaultMedium
OAuth client credentialsSecret long-lived; tokens short-livedSecret theft grants new tokensMedium to high
Platform-managed identityTokens of minutes to hoursMisconfigured role bindingsHigh
Credential types for service accounts

The strongest option removes stored secrets entirely. With managed identities or workload identity federation, the platform attests that a workload is genuine and issues a short-lived token, so there is nothing to copy, leak or forget to rotate. Kubernetes projected service account tokens, for example, default to a one-hour lifetime and are bound to a specific pod.

Service accounts compared with other account types

Service accounts differ from human accounts in purpose, authentication and accountability. The comparison helps decide which type an automation should use.

Account typeUsed byInteractive loginAccountability
Service accountOne application or workflowShould be deniedThe workload and its named owner
Personal user accountOne named personYes, with MFAThat person
Shared accountSeveral peopleYesUnclear; avoid wherever possible
Robotic process automation bot accountAn unattended software robotYes, via the user interfaceThe bot and its process owner
Break-glass accountAdministrators in emergenciesYes, rarely and monitoredWhoever retrieved the sealed credential
Service accounts and other identity types

Running automation under a personal account is the most common anti-pattern. The job breaks when the person changes role or leaves, its actions are indistinguishable from the person’s own, and the account usually holds far more privileges than the job needs.

Securing service accounts in practice

Securing a service account means limiting what it can do, protecting how it proves its identity and watching how it is used. The following controls form the established baseline.

  • One account per workload: a separate identity for each application or workflow limits the blast radius of a compromise and keeps logs unambiguous.
  • Least privilege: grant only the specific permissions the job uses, scoped to the specific resources, and review them after every major change.
  • No interactive logon: deny console and remote desktop sign-in, and on Linux assign a non-login shell.
  • Secrets in a credential vault: store any remaining password or key in a credential vault, retrieve it at runtime and never commit it to a repository.
  • Automatic rotation: prefer mechanisms that rotate secrets without human action, such as group managed service accounts, whose passwords Active Directory changes every 30 days by default.
  • Named human owner: every service account needs a responsible person or team recorded in an inventory.
  • Logging and anomaly detection: feed sign-ins and actions into the audit trail and alert on use from unexpected hosts, times or APIs.

Service accounts are usually exempt from multi-factor authentication because no person can respond to a prompt. Compensating controls such as network restrictions, certificate-based authentication and conditional access policies tied to known workloads close that gap.

Common weaknesses and how to fix them

Service account weaknesses accumulate quietly because the accounts rarely cause visible problems until they are abused. The table maps frequent findings from security reviews to their risk and remedy.

FindingRiskRemedy
Password never changedLong exposure window after any leakRotate, then move to managed identity
Domain or global admin rightsFull environment takeover if stolenReplace with scoped roles
Key committed to a repositoryAnyone with code access holds the keyRevoke the key, scan history, use a vault
One account shared by many jobsLarge blast radius, unclear audit trailSplit into one account per workload
No owner recordedOrphaned account nobody dares to disableAssign an owner or decommission
Interactive logon allowedAttackers use it like a user accountDeny interactive and remote sign-in
Typical service account findings

A practical starting point is an inventory of all service accounts with owner, purpose, permissions, credential type and last use. Accounts unused for 90 days are strong candidates for disabling, followed by deletion after a short observation period.

In everyday language

A service account is a staff badge issued to a machine instead of a person. An automated program uses it to open the doors it needs, such as a database or a mailbox. The program then works on its own, often at night.

Like a real badge, it should open only the doors the job requires. It should belong to one task and be canceled when that task ends. Nobody carries this badge in person, so it is easy to forget. That is exactly why it needs careful protection.

Seen in the real world

A mid-sized manufacturer runs 14 scheduled integrations that move orders from its web shop into the ERP system. All of them authenticate with the personal account of a senior administrator, which holds domain administrator rights. When the administrator resigns, IT disables the account and every integration fails the following night.

The recovery project creates one dedicated service account per integration, each with read access to the shop database and write access only to the order import tables in the ERP. Passwords are replaced by certificates stored in the credential vault, interactive logon is denied, and all sign-ins flow into the central audit trail. Six months later, an alert fires when one integration account attempts to sign in from an unknown server; because the account cannot log in interactively and holds no administrative rights, the incident is contained to a single integration and resolved within an hour.