Non-human identities: who owns each service account and key, and when is it rotated?

Within 90 days, list every service account, app registration, API key and token with an owner and a rotation date, and block or cap new secrets in policy. Then replace each static secret with a managed identity or federation wherever the platform supports it, and rotate the rest on a schedule your policies enforce.

Reviewed
Next review
Version
1.1
Written for
IT, cloud and security teams on Microsoft 365, Azure, AWS or Google Cloud, with or without on-premises Active Directory

If you only do five things

  1. List every non-human identity with an owner and a rotation date.

    Add purpose, permissions and a review date1. Improper offboarding tops OWASP's list of NHI risks2.

  2. Replace static secrets with federation.

    Use managed identities in Azure, which are free3, and federation elsewhere, as Microsoft, AWS and Google advise456.

  3. Block or cap secrets in policy.

    Block new Entra client secrets or cap them at 180 days7, exempting apps that still need them28. Rotate Google keys: expiry can cause outages6.

  4. Log what they do.

    Send service principal and managed identity sign-ins to your SIEM7. Intruders who compromise a person's account go looking for service principals and API keys8.

  5. Move on-premises services to gMSAs.

    Their passwords change every 30 days9. Ordinary service accounts invite Kerberoasting10.

Find every non-human identity

  1. Export Entra apps and their credentials.

    List app registrations, service principals and managed identities with credential type and end date. Treat those with privileged roles as Tier 0, as the privileged-access sheet describes.

  2. Pull the cloud credential reports.

    The AWS report lists access keys and their last use but skips service-specific credentials such as Bedrock long-term API keys11. In Google Cloud, list user-managed service account keys. The cloud configuration sheet covers removing cloud keys.

  3. Search AD for service accounts.

    Look for user accounts with SPNs, delegation or passwords that never expire12.

  4. Ask about the rest.

    SaaS API keys, GitHub tokens and deploy keys, SSH keys, what your IT provider set up, CI secrets (see the supply-chain sheet) and agents (see the agentic AI sheet). Check sign-ins, disable what nobody claims, delete it after a set period1.

Replace static secrets, platform by platform

  • Azure: managed identities. Where an app registration is unavoidable, use a managed identity as its federated credential3.
  • Into Entra: federated credentials. They accept tokens from GitHub Actions, Kubernetes, Google Cloud, AWS and SPIFFE4.
  • Into AWS: roles. From outside AWS, use IAM Roles Anywhere with an X.509 certificate, or AssumeRoleWithWebIdentity5.
  • Into Google Cloud: Workload Identity Federation. Then block key creation; organizations created before 3 May 2024 may not block it by default13.
  • Secrets that must stay: your platform's store. Key Vault, AWS Secrets Manager or Google Secret Manager, each with a rotation schedule. Key Vault can trigger rotation 30 days before expiry14. Encryption keys are in the encryption sheet.
  • Self-hosted stores: check the license. HashiCorp Vault's Business Source License allows internal production use, but not a competing hosted or embedded paid offering15. OpenBao, a fork managed by the Linux Foundation's OpenSSF16, uses the open-source MPL 2.017.

Service accounts in Active Directory

  • Prefer gMSAs and dMSAs. A Windows Server 2025 dMSA replaces a service account and disables its password, so every machine using it must support dMSA10. Keep user accounts out of privileged groups12.
  • Patch BadSuccessor. With a Windows Server 2025 DC, the right to create a dMSA in an OU let users take over any account. Users outside Domain Admins held it in 91% of environments Akamai examined18. Install the August 2025 fix (CVE-2025-53779)19, limit dMSA creation to trusted admins and audit events 5137 and 513618.
  • Guard the KDS root key as Tier 0. Whoever reads it can compute gMSA and dMSA passwords offline, unlogged by default. Audit reads of msKds-RootKeyData20.

When a secret leaks

  1. Revoke it where it was issued.

    Add a new credential, switch over, then delete the leaked one, or all of them if unsure21. Deleting it from the repository isn't enough6; for scanning, see the attack-surface sheet.

  2. Check whether it was used.

    Search sign-in and audit logs since the leak for unusual sign-ins, new credentials, configuration changes and app roles21.

  3. Rotate what it could reach.

    Include vault secrets the identity could read21 and, if a developer machine leaked it, that machine's SSH, API and cloud keys8.

Monitoring, and the licenses it needs

  • Keep the logs. Entra keeps sign-ins 7 days on Free and 30 on P1 or P2. Graph activity logs need P1 or P2 and an export22.
  • Read the detections. ID Protection flags leaked app credentials and anomalous activity, but not for managed identities21.
  • Pay for details and blocking. Workload ID Premium, $3 per workload identity a month23, adds full risk details21 and Conditional Access by location or risk for your own single-tenant apps24.

What changed in 2026

  • Agents got their own identities. Entra Agent ID became generally available in April 2026, and Lifecycle Workflows can hand sponsorship to a leaver's manager25. Entra security features for agents need Agent 36526.
  • CISA set credential limits. ScubaGear 2.0 recommends app secrets of up to 180 days and certificates up to 365 (enter 181 and 366)7.
  • AWS federates outward. Since November 2025, workloads can use short-lived tokens instead of stored API keys for external services27.

What you can skip

  • An NHI security platform before a list. Credential reports and sign-in logs hold most of the data. Buy tooling once owners are named.
  • Workload ID Premium everywhere. Its Conditional Access covers only your own single-tenant apps24. Buy it for privileged ones.
  • Vaulting secrets you could delete. A vaulted secret is still a secret, and a self-hosted vault is one more Tier 0 system.

Mistakes that cost the most

  • One person as the only owner. Name a team too, or a leaver orphans it.
  • Expecting a policy to fix old credentials. Entra app management policies leave existing apps and their secrets working28.
  • Trusting private repositories. GitGuardian's vendor report found secrets in 32.2% of internal repositories and 5.6% of public ones29.

What this looks like at your size

Small team, no security staff

  • Keep the inventory in a shared spreadsheet; review it quarterly.
  • Block new Entra client secrets (free, per Microsoft's FAQ23), exempting apps that need them28.

Growing, with IT or security staff

  • Alert on new app credentials and on interactive service account sign-ins.
  • Move AD services to gMSAs, starting with accounts that have SPNs.

Enterprise or regulated

  • Buy Workload ID Premium for privileged apps; reviewing them needs P2 for reviewers23.
  • Give each AI agent a sponsor who confirms twice a year that it's still needed.