delivered for clients · names withheldmodernization Security operations

Service account, API key and non-human identity cleanup

Cohash cleans up non-human identities. Active Directory service accounts, Entra ID app registrations, cloud roles and keys, SaaS OAuth grants, API keys, AI agents. We build one inventory, give every identity an owner and remove what's unused. Then we move workloads to federation and managed identities, rotate or vault whatever has to stay static, and add the survivors to access reviews in SailPoint, Saviynt or Entra ID Governance.

  1. 01Inventory
  2. 02Owners and dead weight
  3. 03Federate first
  4. 04Rotate or vault the rest
  5. 05Governance
case-study / service-account-and-nhi-cleanup delivered
beforeUnowned service accounts, keys and app registrations afterOwned, federated, short-lived machine identities
01 · WORKLOADS 02 · IDENTITY AND SECRETS 03 · GOVERNANCE CI/CD pipelines: no stored secret CI/CDpipelines no stored secret Azure workloads: VMs · App Service · Functions Azureworkloads VMs · AppService ·Functions Kubernetes pods: service account tokens Kubernetespods service accounttokens AI agents: sponsor and expiry AI agents sponsor andexpiry Windows services: dependencies mapped Windowsservices dependenciesmapped Entra workload identities: OIDC federation · managed identity Entra workloadidentities OIDC federation ·managed identity Entra Agent ID: blueprints · sponsors Entra Agent ID blueprints · sponsors Vault or PAM: rotated static passwords Vault or PAM rotated staticpasswords NHI inventory: owner · last use · permissions NHI inventory owner · last use ·permissions SailPoint or Saviynt: owner certifications SailPoint or Saviynt owner certifications
case file

The story

Told without the client's name or anything that could identify them.

what happened

A healthcare company's identity team had more service accounts than people in Active Directory, most with no owner, and app registrations holding client secrets that never expired. It became urgent when Microsoft's mandatory MFA for Azure sign-ins reached phase 2 and scripts that still signed in as users began to break. We pulled service accounts, app registrations, cloud keys, SaaS OAuth grants and agents into one inventory and joined them on owner, last use and permissions. Unowned and unused identities went through disable, wait, then delete. Workloads moved to federation and managed identities, and the few static credentials that had to stay went into the vault with rotation.

why it was urgent

Scripts signing in to Azure as a user have started to break. That's phase 2 of Microsoft's mandatory MFA for Azure sign-ins, in effect from 1 October 2025. Workload identities are exempt. OWASP's 2025 Non-Human Identities Top 10 names improper offboarding and secret leakage among its top risks, along with long-lived secrets. Entra stops auto-granting AgentIdentity.CreateAsManager on 4 November 2026.

problem statement
  • openService accounts outnumber people in Active Directory and most have no owner.
  • recurringApp registrations hold client secrets that never expire.
  • blockedThere's still a script that signs in to Azure as a user, with a password and an MFA exclusion.
  • openNobody can say which SaaS apps hold OAuth grants to the tenant.
  • recurringSomebody's AI agents are running on ordinary app registrations with broad Graph permissions.
architecture

The estate, before and after

before
before

Before: unowned accounts, static secrets and user sign-ins

Scripts signed in to Azure as a user with an MFA exclusion, pipelines and agents used app registrations with long-lived secrets, and Windows services ran on service accounts nobody owned. SaaS OAuth grants were not listed anywhere.

Before: unowned accounts, static secrets and user sign-ins Scripts signed in to Azure as a user with an MFA exclusion, pipelines and agents used app registrations with long-lived secrets, and Windows services ran on service accounts nobody owned. SaaS OAuth grants were not listed anywhere. 01 · WORKLOADS 02 · CREDENTIALS 03 · TARGETS password sign-in MFA excluded stored secret borrowed identity client credentials OAuth grant hardcoded password Kerberos · NTLM Scheduled scripts sign in as a user CI/CD pipelines stored client secret AI agents on ordinary appregistrations Windows services app pools · scheduled tasks User account + MFAexclusion password in a script App registration secrets never expire AD service accounts no owner · static password Ex Azure and MicrosoftGraph broad Graphpermissions SaaS apps OAuth grants nobody lists On-premises apps file shares · databases
Read the diagram as text
  1. Scheduled scripts → User account + MFA exclusion: password sign-in
  2. User account + MFA exclusion → Azure and Microsoft Graph: MFA excluded
  3. CI/CD pipelines → App registration secrets: stored secret
  4. AI agents → App registration secrets: borrowed identity
  5. App registration secrets → Azure and Microsoft Graph: client credentials
  6. App registration secrets → SaaS apps: OAuth grant
  7. Windows services → AD service accounts: hardcoded password
  8. AD service accounts → On-premises apps: Kerberos · NTLM
after
after

After: owned, federated machine identities under review

We moved workloads to federation and managed identities and gave agents their own identity type. The service accounts that had to stay rotate in the vault. One inventory feeds the certification campaigns, where owners review what their identities can reach.

After: owned, federated machine identities under review We moved workloads to federation and managed identities and gave agents their own identity type. The service accounts that had to stay rotate in the vault. One inventory feeds the certification campaigns, where owners review what their identities can reach. 01 · WORKLOADS 02 · IDENTITY AND SECRETS 03 · GOVERNANCE OIDC federation managed identity workload identity agent identity rotation SP and app data agents and sponsors vaulted accounts certification campaigns CI/CD pipelines no stored secret Azure workloads VMs · App Service ·Functions Kubernetes pods service account tokens AI agents sponsor and expiry Windows services dependencies mapped Ex Entra workloadidentities OIDC federation ·managed identity Entra Agent ID blueprints · sponsors Vault or PAM rotated staticpasswords NHI inventory owner · last use ·permissions SP SailPoint or Saviynt owner certifications
Read the diagram as text
  1. CI/CD pipelines → Entra workload identities: OIDC federation
  2. Azure workloads → Entra workload identities: managed identity
  3. Kubernetes pods → Entra workload identities: workload identity
  4. AI agents → Entra Agent ID: agent identity
  5. Windows services → Vault or PAM: rotation
  6. Entra workload identities → NHI inventory: SP and app data
  7. Entra Agent ID → NHI inventory: agents and sponsors
  8. Vault or PAM → NHI inventory: vaulted accounts
  9. NHI inventory → SailPoint or Saviynt: certification campaigns
results

What the client got

What changed for the client once the work was done. Described, not scored: we don't publish client figures.

  1. result 01

    Every machine identity has an accountable owner

    We assigned owners using HR data and change records, and agreed escalation to application owners before the review started. Identities nobody claimed were put on a disable list with a date.

  2. result 02

    Pipelines and Azure workloads sign in without stored secrets

    OIDC federation, managed identities and Kubernetes workload identity replaced client secrets and scripts that signed in as a user, so nothing depends on an MFA exclusion any more.

  3. result 03

    Unused identities are disabled before they are deleted

    Nothing is deleted straight away. It's disabled, left for the waiting period, then deleted, and the rollback steps are written down, so a quarterly job that last-sign-in data missed comes back quickly.

  4. result 04

    Static passwords that remain rotate in the vault

    The accounts that still need passwords are in PAM or Vault, and they rotate. We mapped each one's scheduled tasks, app pools and Windows services before onboarding it.

  5. result 05

    Machine identities and agents go through access reviews

    Owners now certify their identities in campaigns. We made an owner and expiry mandatory at creation, and moved agents off app registrations and onto agent identity types.

what can go wrong

Risks we plan for

  1. Disabling something critical

    Last-sign-in data can miss a job that runs once a quarter. So we disable first and delete later, with a waiting period and a quick way to turn things back on.

  2. Owners who don't answer

    Without accountable owners, the inventory just sits there. We agree escalation paths to application owners and their managers before the review begins.

  3. Rotation outages

    A service account behind scheduled tasks, app pools and Windows services breaks if its password changes in one place but not the others. We map where it's used first.

  4. Agents built on borrowed identities

    Agents running on app registrations or personal tokens look like everything else in the inventory, so they're easy to miss. Each needs its own identity type and a sponsor.

ai in this move

Where AI helps, and where it needs guardrails

We move agents off app registrations and onto proper agent identities. Microsoft Entra Agent ID, now generally available, gives them identity blueprints, sponsors and access packages. Okta for AI Agents covers registration and certification. We do use AI agents ourselves, to draft owner suggestions and dependency maps from logs. But a person makes every disable, delete and rotation call.

forward deployed engineers →
you keep

What you're left with

We write these for your setup, and they're working documents. Your team should be able to keep things running from them long after we've gone.

  • inventory01

    Unified non-human identity inventory with owner, last use and permissions

    yours to keep
  • plan02

    Disable and delete schedule with rollback steps

    yours to keep
  • plan03

    Federation and managed identity migration plan per workload

    yours to keep
  • plan04

    Rotation onboarding plan with dependency maps

    yours to keep
  • design05

    Certification campaign design for machine identities and agents

    yours to keep
talent and delivery · owned, federated, short-lived machine identities

Certified engineers, wherever you need them.

Some clients want a project team, some want a couple of engineers on theirs. Either works. Onsite, nearshore or offshore, with handovers across time zones that keep things moving.

Onsite

Engineers at your sites in the US

Nearshore

Overlapping hours with US teams

Offshore

Overnight progress on your backlog

All time zones

Coverage handed over across time zones

24-hour coverage · US Central time
OnsiteUS business hours
Nearshoreoverlapping US hours
Offshoreovernight progress
Combinedhandover, not hand-off
01Do we need a dedicated NHI tool?

Not always. Entra ID, your IGA platform and the cloud IAM reports can produce a first inventory between them. A dedicated tool earns its cost when SaaS OAuth grants and secrets are spread over many platforms. We begin with the tools you already own and show you where they fall short.

02How many identities can we safely remove?

You can't tell until last-use data is in the inventory. Plenty of estates hold identities that stopped authenticating long ago. We still put every one through disable, wait, then delete.

03What drives the effort?

The number of systems to pull from, how many identities have no clear owner, and how many workloads need code or pipeline changes to use federation.

sources 6 sources linked last checked 2026-10-20 content fingerprint 567a66d4
  1. 01OWASP: Non-Human Identities Top 10 for 2025owasp.org ↗
  2. 02Microsoft Learn: Plan for mandatory Microsoft Entra MFA (phase 2 from 1 Oct 2025, workload identities exempt)learn.microsoft.com ↗
  3. 03Message Center MC1506728: AgentIdentity.CreateAsManager change (4 Nov 2026)mc.merill.net ↗
  4. 04Microsoft Learn: What's new in Microsoft Entra Agent IDlearn.microsoft.com ↗
  5. 05Okta support: What's new in Okta for AI Agentssupport.okta.com ↗
  6. 06Microsoft Learn: Workload identity federationlearn.microsoft.com ↗
Reviewed by the Cohash team Product names are trademarks of their owners. how we handle facts and data →
next step

Planning this move?

A 30-minute working session with a senior engineer. No slides.

useful to bring
  • The platform and the version you're on
  • Where you need to get to, and by when
  • What's custom: rules, plugins, integrations
  • Any audit finding or deadline driving it