# Service accounts and secrets: where small IT teams leak

> Service accounts, API keys and stored passwords leak in predictable places. Here is where to look and what to change first.

- Published: 2026-11-24
- Topic: [Security](https://futuretechnologyhq.com/topic/security/)
- URL: https://futuretechnologyhq.com/article/service-accounts-and-secrets-where-small-it-teams-leak/
- Publisher: [Future Technology HQ](https://futuretechnologyhq.com/), free to read. Quote as "Future Technology HQ" with a link to the article.

## Key points

- Service accounts need an owner, a written purpose and the fewest rights possible, just like staff accounts
- Prefer identities where the platform manages the credential: gMSAs on premises, managed identities in Azure and IAM roles in AWS
- Keep service accounts out of privileged groups and give each service its own account
- Keep secrets out of scripts, code and pipeline variables, and block new ones before they are pushed
- If a secret is exposed, revoke it first, because deleting the commit does not remove it from history

## Article

The accounts and keys that software uses to talk to other software rarely get the attention that staff passwords do. This guide covers where they leak in a small IT estate and what to change first.

## What we mean by service accounts and secrets

A service account is an identity that a program uses rather than a person. Microsoft describes it as the account used to start a service, and that account sets what the service can reach on the local machine and the network. In Active Directory it might be a domain user called something like sql-backup. In Microsoft Entra ID, Microsoft's cloud directory, it is usually a service principal, which Microsoft defines as the identity of an application instance in your tenant. In AWS it is an IAM user or an IAM role.

A secret is whatever proves that identity: a password, an API key (a long string a program presents to another service), an access key, a client secret, a certificate's private key or a token.

The NCSC puts the point plainly: "Service/machine credentials are just as important as people's." The difference in practice is that people get onboarding, MFA prompts and a leavers' checklist. Service accounts often get none of those.

## Where small teams leak

### 1. An ordinary user account doing a service's job

A familiar pattern is a domain account created years ago to run a backup job, a scanner or a line-of-business app, with a password someone typed once and never changed. Microsoft sets out an order of preference for on-premises services: a group managed service account (gMSA) whenever possible, then a standalone managed service account (sMSA), and only after that a computer account or a user account.

The reason is password handling. With a gMSA, Windows looks after the password. Microsoft says gMSAs use 240-byte, randomly generated passwords, and that the operating system changes the password every 30 days, so administrators do not need to schedule password changes or manage service outages. A user account needs a person to do that.

Microsoft says sMSAs require at least Windows Server 2008 R2 and run on only one server. Not every service supports them. Microsoft gives failover clustering as an example of one that does not, and says to test a service with a gMSA before it goes to production.

### 2. Service accounts in privileged groups

When an installer fails on permissions, the quick fix is to add its account to Domain Admins and move on. Microsoft is direct about this: service accounts should not be members of any privileged groups, because that membership confers permissions that might be a security risk. Managed accounts are no exception.

The cloud version of the same mistake is a broad role. Microsoft's service principal guidance says to grant a service principal enough permissions and scope to run the required tasks.

### 3. One account shared by several services

Microsoft says each service should have its own service account for auditing and security purposes. When three services share one account, you cannot tell which of them made a change, and you cannot rotate the password without breaking all three at once. Running a service as the computer account has a similar problem: Microsoft notes that you then cannot determine which service on the computer is using that account.

For cloud workloads the NCSC gives the same advice: use a different service identity for each use case, such as a single microservice, component or administrative function.

### 4. Secrets written into scripts and code

OWASP, the open security community behind the Secrets Management Cheat Sheet, notes that many organisations have secrets hardcoded within their source code in plaintext. In a small team the "code" is often a PowerShell script on a file share, a scheduled task or a config file in a Git repository.

Microsoft's service principal guidance recommends using client certificates rather than client secrets when possible. It explains that certificates are more secure and that, unlike client secrets, client certificates cannot be embedded in code accidentally.

### 5. Powerful credentials in pipeline variables

CI/CD (continuous integration and continuous delivery, the pipelines that build and deploy code) needs credentials to deploy anything. A pipeline variable holding a cloud administrator key is within reach of anyone who can edit the pipeline.

### 6. Long-lived cloud keys

AWS recommends relying on temporary credentials instead of creating long-term credentials such as access keys, and says workloads should use IAM roles. When code runs on an AWS compute service such as EC2 or Lambda, AWS delivers temporary role credentials to it, so there is no need to hand out long-lived IAM user keys.

Microsoft's equivalent is managed identities for Azure resources. Microsoft says they remove the need for developers to manage credentials, that the credentials are not even accessible to you, and that managed identities can be used at no extra cost. The NCSC's cloud guidance reaches the same place: let your cloud provider manage the credentials for service identities, and where a credential is needed, make it a randomly generated high-entropy cryptographic secret rather than a password.

### 7. Nobody owns the account

The last leak is organisational. Service accounts outlive the projects and the people who created them. The NCSC points out that external suppliers and services also join and leave organisations, so their accounts belong in your joiners, movers and leavers process.

## Fixing it in order

You do not need a new platform to start. This order suits a team of one or two people:

1. **Find them.** In Active Directory, `Get-ADServiceAccount -Filter *` lists managed service accounts. Ordinary accounts acting as service accounts are harder to find, so Microsoft recommends reviewing every account with access to important resources. In Entra ID, `az ad sp list` or `Get-MgServicePrincipal -All:$true` lists service principals. In AWS, last accessed information shows users, roles and credentials you no longer need.
2. **Name and document them.** Microsoft recommends a prefix such as "svc-" on service accounts, plus a record of each one's owner, purpose, permission scopes, risk profile, expected lifetime and, for user accounts, where the password is stored. If the risk is high, Microsoft says to use a managed service account.
3. **Strip privileges.** Take service accounts out of privileged groups and grant the specific rights each service needs.
4. **Let the platform hold the credential.** Move on-premises services to gMSAs where they support it, and cloud workloads to managed identities or IAM roles. Microsoft's gMSA migration starts with deploying the Key Distribution Service (KDS) root key in the forest, a one-time operation, and ends with deleting the old service account.
5. **Vault what is left.** Some secrets have to exist. A secrets manager is a service that stores secrets, controls who can read them and logs their use. Microsoft recommends Azure Key Vault for certificates and secrets where possible. OWASP advises standardising and centralising your secrets management with care, and says engineers should not have access to every secret in it.

## When a secret leaks

Revoke first, then issue a replacement, then clean up the code.

After that, check whether the old credential was used. The NCSC's advice for suspicious credential use is to reset or lock the accounts concerned and then investigate for further compromise. AWS also recommends updating long-term access keys when needed, such as when an employee leaves.

## Frequently asked questions

### What is a service account?

An identity that a program uses instead of a person, such as the account that runs a backup job or lets an application read a database. It decides what the service can reach, so it needs an owner, minimal rights and a protected credential.

### What is a group managed service account?

A gMSA is an Active Directory account for services where Windows manages the password. Microsoft says it uses 240-byte random passwords that the operating system changes every 30 days, and it can run on one server or several.

### What should I do if I commit a secret to GitHub?

Revoke the secret straight away and issue a new one, then remove it from the code. Deleting the commit is not enough, because the secret stays in the repository history. Then check the logs for any use of the old credential.

## What to do next week

Set aside an hour on Monday to list every service account and service principal you can find, with an owner next to each. On Tuesday, check which of them sit in Domain Admins or hold Contributor or broader roles, and pick the riskiest one to fix this week. Search your script shares and repositories for passwords and keys, and revoke anything you find before you tidy it away. If your code lives on GitHub, check that push protection is on. Then put a reminder in the diary to review the list again in three months.

## Sources

- [Microsoft Learn, Introduction to Active Directory service accounts](https://learn.microsoft.com/en-us/entra/architecture/service-accounts-on-premises)
- [Microsoft Learn, Secure group managed service accounts](https://learn.microsoft.com/en-us/entra/architecture/service-accounts-group-managed)
- [Microsoft Learn, Securing service principals in Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/architecture/service-accounts-principal)
- [Microsoft Learn, Managed identities for Azure resources](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview)
- [NCSC, Identifying suspicious credential usage](https://www.ncsc.gov.uk/blog-post/identifying-suspicious-credential-usage)
- [NCSC, Cloud security guidance: using a cloud platform securely](https://www.ncsc.gov.uk/blog-post/cloud-security-made-easier-with-serverless)
- [AWS, Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)
- [GitHub Docs, About push protection](https://docs.github.com/en/code-security/concepts/secret-security/about-push-protection)
- [OWASP, Secrets Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html)
