Guide
Service Account Governance: Own, Review and Retire Service Accounts
What service account governance means, the record to keep for each account, where service accounts hide in Keycloak, GitHub and AWS, and how to review them.
Part of the guide User Access Review: How to Run One, Step by Step
Every company that runs software has accounts that no person signs in to: the deploy job, the backup script, the app that reads from another app. They hold access like everyone else, and often more. This guide explains what service account governance means, the record to keep for each account, where these accounts hide in Keycloak, GitHub and AWS, and how to review them in the same user access review as people.
Service account governance means knowing every account that a program uses, giving each one a named owner and a written purpose, keeping its access to what the program needs, reviewing it on a schedule your policy sets, and removing it when the program is gone. The goal is simple: no account with access and nobody who answers for it.
What a service account is
A service account is an account that a program uses instead of a person. Other names for the same thing: system account, application account, machine account, bot account, and non-human identity. A credential is whatever the program uses to show the system who it is, such as a password, an API key, a token or a key file.
Service accounts are a governance problem for three reasons:
- Nobody notices them. A person who leaves is usually caught by HR. A script that stops running is caught by nobody, and its account keeps its access.
- They often hold a lot. A deploy job may be able to change production. An integration may read every user in your identity provider, the system people sign in through.
- Their credentials travel. A key copied into a configuration file, a CI system (the tool that builds and deploys your code) or a laptop is hard to track and easy to forget.
An account that still works but no longer belongs to anyone who needs it is an orphaned account. Service accounts become orphaned easily, because no leaving date prompts anyone to look at them.
Governance and secrets management are different jobs
People often mix up two jobs. Secrets management is about the credential: where it is stored, who can read it, and how often it is changed. A secrets manager is a tool that stores credentials so they are not written in code or files. Governance is about the account: why it exists, who owns it, what it may do, and when it goes. You need both. A perfectly stored key for an account nobody needs is still a risk, and so is a well-owned account whose password sits in a script.
What the frameworks say about service accounts
Here is what the primary texts say. PCI DSS has requirements written for these accounts; the others cover them through general account rules.
| Framework | What the text says |
|---|---|
| PCI DSS v4.0.1, 7.2.5 and 7.2.5.1 | 7.2.5: application and system accounts get the least privileges needed for the system or application to work, and access is limited to the systems, applications or processes that need them. 7.2.5.1: all access by these accounts is reviewed periodically, at the frequency your targeted risk analysis sets, to check it is still appropriate for the function. Inappropriate access is addressed, and management acknowledges that the access that remains is appropriate. |
| PCI DSS v4.0.1, 8.6.1 to 8.6.3 | 8.6.1: if these accounts can be used to sign in interactively, that use is prevented except in an exceptional circumstance. When it happens, it is limited in time, justified in writing and approved by management, the person's identity is confirmed first, and every action can be traced to that person. 8.6.2: passwords for these accounts that can be used to sign in interactively are not hard coded in scripts, configuration files or custom source code. 8.6.3: their passwords are changed periodically, at the frequency your targeted risk analysis sets, and when a compromise is suspected or confirmed, and they are complex enough for how often you change them. |
| NIST SP 800-53 Rev. 5, AC-2 | Define and document the types of accounts allowed and forbidden, assign account managers, require approval to create accounts, and review accounts against your account management rules at a frequency you set. The discussion lists service accounts among the account types, and shared, group and guest accounts among those you may choose to forbid. |
| SOC 2, CC6.2 and CC6.3 | CC6.2: users whose access you administer are registered and authorized before credentials and access are issued, and their credentials are removed when access is no longer authorized. CC6.3: access is authorized, modified or removed based on roles, responsibilities, or the system design and changes, with least privilege and segregation of duties in mind. Ask your auditor how they expect service accounts to appear in your access review. |
| ISO/IEC 27001:2022, 5.16 and 5.18 | Annex A control 5.16, Identity management, covers the full life cycle of identities. Control 5.18, Access rights, covers giving, reviewing, changing and removing access in line with your access control policy. Neither sets an interval. |
Sources: PCI DSS v4.0.1 from the PCI Security Standards Council, NIST SP 800-53 Rev. 5, the AICPA’s trust services criteria, and ISO/IEC 27001:2022 Annex A, which ISO sells on its website. A targeted risk analysis is a documented assessment, described in PCI DSS requirement 12.3.1, that sets and justifies an interval the standard leaves to you.
The record to keep for each service account
Governance starts with a list. Keep one line per service account, in a spreadsheet or a ticketing tool, with these fields:
| Field | What to write |
|---|---|
| Account | The exact name in the system, such as the username, client ID, key ID or role name |
| System | Where the account lives: Keycloak, GitHub, AWS, a database |
| Owner | One named person on the team that runs the program, and a backup |
| Purpose | What program uses it and for what, in one sentence |
| Access | The roles, groups, policies or repositories it holds |
| Credential | The type (password, key, token, role with temporary credentials) and where it is stored |
| Can a person use it | Whether someone could sign in with it by hand, and who knows the credential |
| Last used | The date the system last saw it used, if the system records it |
| Created and review date | When it was made, who approved it, when it was last reviewed, and the next review |
Here is an example line. The names and dates are made up:
| Field | Example |
|---|---|
| Account | service-account-billing-sync |
| System | Keycloak, production realm |
| Owner | Priya Shah, Payments team. Backup: Payments on-call |
| Purpose | The billing app reads customer accounts from Keycloak every night |
| Access | view-users on the realm-management client |
| Credential | Client secret, stored in the payments secrets manager |
| Can a person use it | No. Only the billing app uses it, with the client secret |
| Last used | Unknown: this realm does not keep login events |
| Created and review date | Created 3 March, approved by the Payments lead. Reviewed 10 June, next December |
The owner is the field that matters most. An account with a name next to it gets a decision in every review. An account without one gets kept because nobody dares remove it. A naming rule helps too: if every service account name says what it is for, such as billing-sync, the list is easier to read and strays stand out.
Where service accounts hide in Keycloak, GitHub and AWS
Each system has more than one kind of account a program can use, and the obvious list shows only some of them. You can forward this table to your engineers as the list of things to export.
| System | Kinds of service account | What to check |
|---|---|---|
| Keycloak | Each client (an app registered in Keycloak) has a built-in service account, switched on with Client authentication and the Service account roles setting. Its user is named service-account- followed by the client ID, and the Users list leaves it out: find it through the client. Some teams also create ordinary users for scripts. | The roles in each client's Service account roles tab. Roles from the realm-management client, such as manage-users, are admin rights in the realm (a realm is one separate set of users and apps in Keycloak). Ordinary users made for scripts, which look like people in the user list. |
| GitHub | GitHub Apps installed on the organization. Machine users: ordinary GitHub accounts created for automation, added as members or as outside collaborators (people given access to some repositories without joining the organization). Deploy keys, which are keys added to a single repository. Personal access tokens that people create for scripts. | The permissions and repositories each installed app has. Every deploy key, and which ones can write: they have no expiry date and stay active when the person who added them is removed from the repository. Fine-grained tokens, the newer kind, which organization owners can list and revoke. Classic tokens do not appear in that list, and can still reach organization resources unless the organization restricts them. |
| AWS | IAM roles that programs take on (AWS says "assume"), such as a role for a Lambda function or an EC2 server, which are AWS services that run code. IAM users created for a program, with long-term access keys. | IAM users with access keys, and when each key was last used. Roles that have not been used for months. Who may assume each role, especially roles that a CI system or another AWS account can take on. |
Sources: Keycloak’s Server Administration Guide on service accounts; GitHub’s pages on installed GitHub Apps, deploy keys and machine users and reviewing personal access tokens; and AWS’s IAM security best practices, credential report and role last used data.
Two notes on AWS. First, AWS recommends that workloads use IAM roles, which hand out temporary credentials, rather than IAM users with long-term access keys. An IAM user with an access key that a program uses is the line to look at first. Second, AWS records when each role was last used, for the trailing 400 days, or less in a Region that started tracking more recently. A role with no use in that window is a strong candidate for removal. Roles that an AWS service created for itself are tied to that service, so check with your engineers before you count them as unused. The AWS IAM Access Analyzer guide shows how to list unused roles and keys in one place.
How to govern service accounts, step by step
- Write the rule. Add a short section to your access control policy: every service account is approved before it is created, has a named owner and a purpose, gets only the access its program needs, and is reviewed on a schedule you set. If PCI DSS applies, write down the interval your targeted risk analysis sets.
- Find them all. Ask each system owner for every account a program uses, using the table above as the checklist. Include accounts in test systems that can reach production.
- Name an owner for each one. Start with the person who created it or the team whose program uses it. If nobody claims an account, check when it was last used, tell the engineering team, then disable it for an agreed period before you delete it.
- Cut the access to what the program needs. This is least privilege. The common fix is to replace a broad admin role with the one or two permissions the program uses.
- Move credentials out of code. Put passwords and keys in a secrets manager, not in scripts or configuration files. Where the system allows it, use credentials that expire, such as AWS roles, instead of long-term keys.
- Change credentials on a schedule, and at once after a leak. Set how often each long-term key or password is changed. Change it straight away if it shows up somewhere it should not, such as in code or a chat message, or if someone who knew it leaves.
- Stop people from signing in as the account. For example, an AWS IAM user made for a program needs no console password. If a person must use an account in an emergency, record who, when and why, and change the credential afterwards.
- Review on schedule. Send each owner their accounts and ask, for each: is this still needed, is the access still right, and is the credential still where it should be.
- Retire it with the program. When a program is switched off, its accounts and credentials go in the same change. Add this line to your change or decommissioning checklist.
How to include service accounts in your access review
You do not need a separate review. Add service accounts to the list you already send out, with two differences.
Send them to the owner, not a manager. A person’s line goes to their manager. A service account’s line goes to the owner in your record. If the owner field is empty, that is the first finding.
Ask about the credential as well as the access. For a person, the question is whether they still need the role. For a program, add: is the credential still stored where it should be, and has it been changed since anyone who knew it left?
Mark service accounts clearly in the list so reviewers do not mistake them for people. A column called Account type, with values such as Person, Service account and Shared, is enough. You can add that column to the free user access review template.
What an auditor asks about service accounts
Which requests apply is for you and your auditor to decide, but these come up often:
- The list. All service accounts in scope, with owner and purpose. An auditor may compare it to an export from the system and ask about any account on one and not the other.
- The review record. For a sample of service accounts, who reviewed them, when, and what they decided.
- The follow-up. For each account marked for removal or change, the date it was done in the system.
- Admin accounts. Why each service account with admin power needs it.
- For PCI DSS. The targeted risk analysis that sets your review interval for these accounts, management’s acknowledgment that the access that remains is appropriate, and how you stop people from signing in with them.
Common mistakes
The owner is a team mailbox. A mailbox cannot decide. Name a person, and a backup.
“It might break something” keeps every account. Check when it was last used, warn the team, then disable it and leave it disabled for an agreed period. If nothing breaks, remove it.
The person who created it left. An account whose owner left is an orphan even if it still runs a live job. Reassign it as part of the leaver process, not at the next review.
Personal tokens used as service accounts. A script that runs on one engineer’s personal access token stops working, or keeps working with too much access, when that person leaves or changes role. Move it to a GitHub App or a dedicated account with its own owner.
Only the identity provider is checked. Keycloak may be clean while an AWS access key from three years ago still works. Check every system on the list.
Where Acciew fits
Acciew runs user access reviews for Keycloak, GitHub and AWS. In AWS it reads IAM users and roles, the policies each holds, who may assume each role, and when each user and role was last used. In GitHub it reads installed applications and outside collaborators along with members and teams. For the other kinds of account on this page, such as deploy keys and personal access tokens, keep your own record. Acciew only reads, so your administrators make every change, and at the end you get an evidence pack of the review.
Have an access review coming up?
Acciew is in early access. We are looking for design partners: teams with a user access review ahead of them.
Apply as a design partnerQuestions and answers
What is a service account?
A service account is an account that a program uses instead of a person, such as a deploy script, a backup job or an app that calls another app. It holds access like any other account. Nobody signs in to it by hand, so nobody notices when it is no longer needed.
Who should own a service account?
A named person on the team that runs the program that uses it, with a team or a deputy as backup. The owner answers for why the account exists and what it can do, and decides on it in each review. Security or IT can keep the list, but should not be the default owner of every account.
How often should service accounts be reviewed?
SOC 2 and ISO 27001 set no interval, so your policy sets it and your auditor tests that you kept to it. If PCI DSS applies, requirement 7.2.5.1 says access by application and system accounts is reviewed periodically, at the frequency your own targeted risk analysis sets. Reviewing them in the same round as people is the simplest choice. Under PCI DSS that round is at least once every six months (7.2.4), so your risk analysis can set the same interval.
What happens to a service account when its owner leaves?
Nothing, unless someone acts. The account keeps working and keeps its access, but now nobody answers for it, which makes it an orphaned account. Add a line to your leaver process: before the person goes, every service account they own gets a new named owner, and any credential they knew is changed.
What is the difference between a service account and a shared account?
A service account is used by a program. A shared account is used by several people who all know its password, such as a single admin login a team passes around. Shared accounts make it hard to tell who did what, and NIST SP 800-53 lists them among the account types an organization may choose to forbid.
This guide is part of User Access Review: How to Run One, Step by Step. Read the whole guide there.