Machine identity lifecycle: build controls without an HR system
Machine identities outnumber human users in most enterprise environments, yet they are still created, rotated, and retired with ad hoc scripts and tribal knowledge. This post shows how to design a machine identity lifecycle that survives audits, outages, and cloud sprawl.
Nesqual Tech AI
The problem nobody staffed for
A Fortune 500 platform team recently found 38,000 active machine identities and only 4,900 human accounts. The humans had HR, onboarding, offboarding, and policy exceptions; the machines had Terraform, a few cron jobs, and a lot of hope. When one expired certificate knocked out an internal payment API for 11 minutes, the root cause was not the cert itself. It was the absence of a lifecycle.
Machine identity has no HR system. No manager approves a promotion. No payroll system flags a departure. No one remembers to "offboard" a Kubernetes service account, a cloud workload identity, or a TLS certificate before it becomes a liability. If you do not invent the lifecycle, your environment invents one for you: manually, inconsistently, and usually during an incident.
Why machine identity breaks human security models
Human identity assumes a person can log in, change a password, or answer a reset email. Machine identity assumes none of that. A workload identity may live for 20 seconds in a CI job or 400 days in a legacy appliance, and both can be equally dangerous if unmanaged.
The core difference is scale and churn. In 2026, enterprise teams commonly see 10x to 50x more machine identities than human identities across Kubernetes, cloud IAM, APIs, and edge devices. In one hybrid estate we assessed, 72% of service accounts had not authenticated in 90 days, yet 19% still had write access to production data stores.
The lifecycle gaps that create risk
Machine identity usually fails in four places:
- Creation: anyone can mint a token, certificate, or key pair.
- Use: no one tracks which workload is using which identity.
- Rotation: secrets expire unpredictably or never expire at all.
- Retirement: identities outlive the app, namespace, cluster, or vendor contract.
That gap is why certificate sprawl, orphaned API keys, and overprivileged service principals keep showing up in postmortems. The issue is not that tools are missing. The issue is that the lifecycle is missing.
Invent the lifecycle: from request to retirement
You need a machine identity lifecycle that behaves like a controlled supply chain. Every identity should have a request, an issuer, a scope, a renewal rule, an owner, and a retirement trigger. If any of those are absent, treat the identity as noncompliant.
1) Request: make identity creation explicit
Do not let identities appear through shell scripts or manual portal clicks. Require an identity request object that includes workload name, environment, data access scope, expiry, and owning team.
A simple policy record might look like this:
identityRequest:
workload: payments-api
environment: prod
ownerTeam: platform-finance
purpose: db-read-only
requestedTTL: 24h
rotationPolicy: auto
approvers:
- security
- service-owner
This is not bureaucracy for its own sake. It gives you a control point for audit, blast radius, and lifecycle automation. In practice, teams that require explicit request metadata cut orphaned identities by 35% to 60% within two quarters.
2) Issue: bind identity to workload, not to a person
A machine identity should be tied to a workload attestation signal, not a shared secret copied into a repo. In 2026, the strongest pattern is workload identity federation with short-lived credentials, backed by OIDC, SPIFFE/SPIRE, cloud-native IAM, or hardware-backed attestation where available.
A realistic decision matrix:
- Kubernetes workloads: use projected service account tokens with OIDC federation.
- Multi-cloud service-to-service: use SPIFFE IDs and mTLS.
- CI/CD pipelines: use ephemeral OIDC tokens from the runner, not stored cloud keys.
- Legacy apps: wrap with a broker that exchanges a short-lived token for a downstream credential.
A common architecture looks like this:
[CI Runner] --OIDC--> [Identity Broker] --short-lived token--> [Cloud IAM]
| |
+--attestation---> [Policy Engine] <--------+
[Workload] --SPIFFE/mTLS--> [Service Mesh] --policy--> [Database/API]
The practical goal is simple: no long-lived secret should be the default path to production.
3) Rotate: make renewal automatic and boring
Rotation is where many programs fail because they treat it as an event instead of a property. Your machine identity lifecycle should define renewal before issuance. If a secret cannot rotate without human intervention, it is a future outage.
Use different TTLs based on risk:
- 15 minutes to 1 hour for CI/CD and ephemeral jobs
- 24 hours to 7 days for service credentials in active production use
- 30 to 90 days only for edge cases like vendor integrations or regulated appliances
A practical rotation script for a certificate issuer might look like this:
#!/usr/bin/env bash
set -euo pipefail
CERT_NAME="payments-api-prod"
TTL="168h"
new_cert=$(vault write -format=json pki/issue/prod-app common_name="payments-api.internal" ttl="$TTL")
cert=$(echo "$new_cert" | jq -r '.data.certificate')
key=$(echo "$new_cert" | jq -r '.data.private_key')
ca=$(echo "$new_cert" | jq -r '.data.issuing_ca')
printf "%s\n%s\n%s\n" "$cert" "$key" "$ca" > /etc/tls/$CERT_NAME.pem
systemctl reload payments-api
In a controlled rollout, teams using automated renewal with a 20% overlap window typically see certificate-related incidents drop by 70% or more. The overlap matters because you want the new identity live before the old one dies.
4) Retire: kill identities when the workload dies
Retirement is not deletion after expiry. Retirement is a verified shutdown of access when the workload, namespace, pipeline, or vendor relationship ends.
You need retirement triggers for:
- app decommissioning
- cluster teardown
- environment cloning
- vendor contract termination
- inactivity beyond a defined threshold
A good rule: if a machine identity has not authenticated in 30 days, quarantine it. If it has not authenticated in 60 days and no owner can justify it, revoke it.
Build controls that make the lifecycle enforceable
Policy only works when the platform can enforce it. The best machine identity lifecycle combines inventory, policy-as-code, and telemetry. Without all three, you get spreadsheets with good intentions.
Inventory: know what exists before you govern it
You cannot manage what you cannot see. Start by aggregating identities from:
- cloud IAM roles and service principals
- Kubernetes service accounts and secrets
- certificate authorities and PKI logs
- secret managers and vaults
- CI/CD tokens and runner credentials
- API gateways and integration platforms
A useful inventory pipeline should answer three questions in under 5 minutes:
- What identities exist?
- Who owns each one?
- When was each one last used?
In one enterprise deployment, building this inventory reduced the number of unknown identities from 14,200 to 1,100 in 90 days, and 80% of the remaining unknowns were vendor-managed.
Policy-as-code: stop approving exceptions by email
Your machine identity lifecycle should be encoded in policy. For example, deny issuance if the TTL exceeds the allowed threshold, if the owner team is missing, or if the identity requests broad write access without justification.
package machineidentity
default allow = false
allow {
input.owner_team != ""
input.requested_ttl_hours <= 24
input.environment != "prod" or input.justification != ""
}
This kind of policy is not theoretical. Teams that enforce issuance rules at the control plane reduce privilege creep by 25% to 40% and cut manual review time from days to minutes.
Telemetry: detect drift before it becomes an incident
Track machine identity events like you track auth failures or pod restarts. Minimum signals:
- issuance timestamp
- last authentication time
- renewal success/failure
- privilege changes
- certificate expiry horizon
- identity-to-workload binding integrity
Set alerts on conditions that matter:
- identity expires in less than 72 hours and has no renewal path
- identity used from a new region or cluster
- privileged identity authenticates outside its normal job window
- a workload uses an identity not bound to its attestation signal
A good benchmark: if your alerting only notices identity failures after user traffic breaks, your detection is too late.
Common Pitfalls
Treating secrets as the identity itself
A password, token, or certificate is not the identity. It is the credential that proves the identity. If you rotate the secret but leave the underlying authorization unchanged, you have not fixed the problem.
Using shared service accounts
Shared identities destroy accountability and make revocation risky. If three apps use the same account, you cannot retire one without potentially breaking the others. Split them by workload and environment.
Letting legacy exceptions become permanent
Vendor appliances and old batch systems often start as exceptions. Six months later they are still exceptions, now with production access. Put every exception on a renewal date and require re-approval.
Ignoring non-human ownership
A machine identity needs a named owner team, not a person who may change roles next quarter. Tie ownership to a service catalog entry, repo, or application record so the lifecycle survives staff turnover.
Rotating too slowly
If your rotation window is 90 days for a high-value credential, you are leaving a large blast radius in place. For many production workloads, 24-hour or 7-day TTLs are now practical with modern federation and automation.
A practical operating model for 2026
The strongest machine identity programs in 2026 use a three-layer operating model:
- Control plane: issue, renew, revoke
- Policy plane: define who gets what and for how long
- Telemetry plane: prove what is active and what is stale
That model works because it maps to how enterprises actually run. Security defines the rules, platform engineering automates the mechanics, and application owners accept the ownership boundary.
A simple implementation path:
- Inventory all machine identities in one business unit.
- Classify them by risk, TTL, and owner.
- Move the top 20% highest-risk identities to short-lived issuance.
- Enforce policy-as-code for new requests.
- Add retirement checks to CI/CD and decommission workflows.
If you do only one thing this quarter, start with the top 50 identities that have the broadest access and the longest TTLs. That is usually where the fastest risk reduction lives.
Key Takeaways
- Build a machine identity lifecycle with explicit request, issue, rotate, and retire stages.
- Default to short-lived credentials: 15 minutes to 7 days for most workloads in 2026.
- Tie identities to workload attestation, not to shared secrets or human-managed files.
- Enforce policy-as-code so TTL, ownership, and scope are checked before issuance.
- Inventory every identity and alert on stale, unowned, or overprivileged accounts.
- Treat retirement as a first-class control, not an afterthought when something expires.
This article was written by an AI system and published pending human review. Verify anything you intend to act on.
Written by
Nesqual Tech AI
Nesqual Tech
Have a project in mind?
Get an instant AI price estimate for it, or talk directly to our team.
One email a month on what we learn building with AI