Join our Newsletter — 33% off our NHI Course
Home› Guides› AI Agent Credential Lifecycle and Rotation Guide: Issue,…
Guide Agent Identity & Access

AI Agent Credential Lifecycle and Rotation Guide: Issue, Scope, Rotate and Revoke

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 27 October 2026 13 min read
On this page

AI agents accumulate credentials faster than any other identity type, and almost none of them are tied to the agent's own lifecycle: keys outlive the pilot, OAuth grants outlive the user's interest and tokens outlive the task. An agent may hold its own workload credential, delegated user tokens for several SaaS tools, API keys for model providers and MCP servers, and certificates for service-to-service calls, each with a different issuer, lifetime and revocation path. This guide sets out the lifecycle for each type of agent credential, the events specific to agents that should trigger rotation or revocation (a model swap, a new tool, a sub-agent, a sponsor leaving), the lifetimes major platforms actually offer, and how to measure that credentials end when the work does. Where secrets are stored and released is covered in the Credential Vaulting for AI Agents Guide; this page covers what happens to them over time. It is for identity, platform and security engineers running agents in production.

Key takeaways

  • Lifetime should follow the unit of work. Agent identity credentials last hours, task tokens last minutes, delegated user grants last as long as the user's consent and no longer, and static keys exist only where a provider offers nothing else.
  • Agents have their own lifecycle triggers. Beyond joiner, mover and leaver, rotate or re-scope on new tools, changed prompts or models, new sub-agents, environment promotion and the departure of the human sponsor.
  • Revocation must reach every issuer. Disabling the agent in one directory does not revoke the SaaS refresh tokens, MCP server keys or model API keys it holds. Keep an inventory that maps each agent to every credential and issuer.
  • Prefer credentials that expire by design. Federated and attested workload credentials, one-hour app installation tokens and short cloud sessions remove most rotation work; long-lived secrets are the exception that needs a rotation runbook.
  • Retirement is the most skipped stage. Pilots end, agents are replaced and AI apps are forgotten while their grants remain valid, which is how a forgotten AI app's OAuth token became the way into Vercel.

The credentials an agent holds

Credential typeTypical issuerPurposeNative lifetime and rotation
Agent workload identity (federated credential, certificate, WIMSE WIT, SPIFFE SVID)Identity platform or workload identity systemProve which agent is callingShort and automatically renewed when federated or attested; WIMSE drafts recommend WITs of hours with per-request proofs of minutes
Agent blueprint or application credential (client secret, certificate)Directory (for example Microsoft Entra)Lets the platform mint tokens for agent instancesSecrets and certificates have set expiry and need rotation; federated credentials avoid stored secrets
Delegated user access and refresh tokensOAuth authorisation servers of SaaS and MCP serversAct for a user at a specific resourceAccess tokens minutes to an hour; refresh tokens vary widely and may not expire unless the issuer sets policy
App-only access tokens (client credentials, app installation tokens)OAuth servers, GitHub Apps and similarAct as the agent itselfGitHub installation tokens expire after one hour and can be narrowed to repositories and permissions
Cloud session credentialsAWS STS, cloud workload identity federationCall cloud APIsAWS AssumeRole sessions 15 minutes to 12 hours (default one hour), one hour maximum when role chaining
Static API keysModel providers, SaaS tools, internal servicesSimple bearer accessOften never expire; rotation is manual or scripted
Signing keys (request signing, Web Bot Auth, artefact signing)The agent operatorSign requests or outputsOperator-defined; rotate by overlap

Platform designs differ in where the credential lives. In Microsoft Entra Agent ID, agent identities have no credentials of their own: the agent identity blueprint holds federated identity credentials, certificates or client secrets and acquires tokens on the agents' behalf, so the blueprint credential is the one to protect and rotate. In Amazon Bedrock AgentCore Identity, a token vault stores OAuth tokens and API keys so that only the agent and user combination that obtained them can retrieve them, and resource credential providers handle obtaining and refreshing them. See Cloud Agent Identity Services Compared (Entra, AgentCore, Google).

The lifecycle stages

  1. Request and approve: a named sponsor requests the agent, its purpose, the tools it will call and the data it will touch. Entra Agent ID records a sponsor as the human or group accountable for the agent; whatever the platform, record one.
  2. Issue: issue the agent's own identity credential through federation or attestation where possible, never by copying a human's key. Issue delegated tokens only through an interactive consent or an approved token exchange.
  3. Scope: narrow each credential to one resource (audience), the fewest scopes and one environment. The MCP authorisation specification requires clients to send the RFC 8707 resource parameter and servers to validate that tokens were issued for them; RFC 9700 says access tokens should be audience-restricted.
  4. Bind: sender-constrain where the issuer supports it (mTLS, DPoP, WIMSE proof tokens) so a copied token is useless. RFC 9700 requires refresh tokens for public clients to be either sender-constrained or rotated.
  5. Use and observe: log every issuance and use with the agent identifier, the task and, for delegated tokens, the user.
  6. Renew and rotate: renewal is automatic for short-lived credentials; rotation is a planned change of a longer-lived secret or key (see the rotation section).
  7. Re-scope: when the agent's tools, data or autonomy change, reissue credentials with the new scope rather than adding permissions to the old ones.
  8. Suspend and revoke: on incident, misuse or the user withdrawing consent, revoke at every issuer, not just in the agent registry.
  9. Retire: on decommissioning, revoke all credentials, delete stored tokens, remove the identity, and keep audit records.

Agent-specific lifecycle triggers

EventWhy it mattersCredential action
New tool, MCP server or API addedNew resource, new attack surfaceIssue a new, audience-bound credential for that tool; do not widen an existing one
Model, system prompt or agent code changed materiallyBehaviour may change; earlier risk assessment may no longer holdRe-approve scopes; rotate long-lived secrets if the old build could have exposed them
Agent spawns sub-agentsAuthority can propagate further than intendedGive sub-agents their own narrower, shorter credentials through token exchange; never hand down the parent's
Promotion from test to productionTest credentials often over-scoped and widely sharedNew production credentials; destroy test ones
Delegating user leaves or withdraws consentThe agent keeps acting for someone with no current rightRevoke that user's refresh tokens and stored grants for the agent
Sponsor leaves or changes roleNo one accountable; reviews stopReassign sponsor within a set period or suspend the agent
Credential appears in logs, prompts, traces or a repositoryTreat as compromisedRevoke and reissue immediately. See the Leaked Credential Response Playbook.
No activity for a set periodLikely orphanedSuspend credentials, notify sponsor, retire if unclaimed
Third-party agent vendor breachedTokens you granted them may be stolenRevoke grants to that vendor's apps and reissue after review

Setting lifetimes

CredentialRecommended lifetimeRationale
Per-request proof (WPT, HTTP signature, DPoP proof)Seconds to minutesWIMSE drafts specify minutes or less for proofs
Task access tokenTask length plus margin, typically 5 to 60 minutesLimits replay window; renewable within the task
Agent workload identity credentialHours, auto-renewedMatches WIMSE guidance for WITs; cannot usually be revoked on demand, so expiry does the work
Cloud session15 to 60 minutes for interactive agents; longer only for batch jobs that need itAWS allows 15 minutes to 12 hours; set the role's maximum session duration to what agents need
Delegated refresh tokenBounded by policy (for example, days of inactivity and an absolute maximum), rotated on useRefresh tokens are the long tail of agent access. See the OAuth Refresh Token Rotation and Expiry Guide.
Blueprint or application secret or certificateReplace secrets with federated credentials; certificates 90 days or less with automated renewalThe root from which agent tokens are minted
Static API keyAs short as the provider allows; rotate at least every 90 days and on every trigger aboveOWASP NHI Top 10 lists long-lived secrets (NHI7) as a top risk

Small versus large teams: a small team should first remove static keys where federation exists, set refresh token policy at the identity provider and keep a spreadsheet inventory with owners. A large organisation needs automated discovery of agent credentials across clouds, SaaS and code, a registry linking agent identifier to every credential and issuer, and rotation run by pipelines rather than people.

Rotation without outages

  • Overlap, then cut over: create the new secret or key, deploy it to the agent runtime, confirm traffic uses it, then revoke the old one. Two valid credentials should coexist only for a defined window.
  • Rotate the root, not just the leaves: rotating agent access tokens achieves little if the blueprint secret or signing key behind them never changes.
  • Refresh token rotation: where the issuer rotates refresh tokens on use, detect reuse of an old one as a theft signal and revoke the whole grant.
  • Scripted runbooks per provider: each model provider and SaaS tool has its own key API. Script rotation and record the last rotation date per key. See the Secrets Rotation Runbook Template.
  • Do not rotate by redeploying images: a key baked into a container image or agent configuration file survives in every old artefact (T1552.001 Credentials In Files). Inject at runtime instead.

Revocation and retirement

Revocation is where agent credential programmes most often fall short, because agent credentials are spread across many issuers. Build a revocation path for each issuer and test it.

IssuerHow to revokeWhat survives revocation if you stop there
Agent identity platformDisable the agent identity or, in Entra, act on all agents of a blueprint (disable, revoke a permission grant)Third-party tokens already issued to the agent
SaaS and MCP authorisation serversRevoke the user's grant or the client's tokens (RFC 7009 revocation endpoint where offered); remove the app connectionAccess tokens until expiry unless introspected
Token vaultDelete stored tokens for the agent and user pairsTokens still valid at the issuer if not revoked there too
Cloud providerRemove trust policy or federation; revoke active sessionsExisting STS sessions until expiry unless explicitly revoked
Model and SaaS API keysDelete the key in the provider console or APINothing, if deleted, but copies in logs and traces must still be purged

The Vercel Context.ai OAuth breach shows the cost of skipping retirement. An employee had connected an AI office app to a corporate Google account with broad access; the grant was never reviewed or given an expiry, so when the AI vendor was breached the stolen token still worked and gave the attacker the account without a password or MFA. Periodic review of AI app grants, and revocation on disuse, would have closed that path. See the Consent Phishing and Illicit OAuth Grants Guide.

How to implement

  1. Inventory: for every agent, list each credential, issuer, scope, lifetime, storage location, last rotation and sponsor. Include AI apps users connected themselves.
  2. Classify: mark each as expiring by design, rotatable secret or static key, and set a target lifetime from the table above.
  3. Remove the worst first: replace static keys and blueprint secrets with federation where the platform supports it; narrow over-scoped tokens.
  4. Wire triggers: connect agent registry events (tool added, model changed, sponsor left, inactive) to credential actions in your automation.
  5. Build revocation per issuer: script it, then run a tabletop and a live test that revokes a test agent end to end and confirms no credential still works.
  6. Pilot: apply the new lifetimes to one agent class first, watch for task failures caused by expiry, and adjust margins rather than reverting to long lifetimes.
  7. Roll back safely: if shorter lifetimes break a job, extend that job's lifetime explicitly with an owner and end date; never return a whole class to non-expiring credentials.
  8. Review quarterly: sponsors attest to each agent's credentials and scopes. See the Identity Governance for AI Agents Guide.

Detection and measurement

MetricTarget
Agents with a complete credential inventory and named sponsor100%
Share of agent credentials that expire by designRising; static keys only where no alternative exists
Median lifetime of agent access tokensUnder one hour
Static keys older than 90 daysZero
Time from retirement decision to last credential revokedSame day
Credentials still valid for retired or inactive agentsZero

Framework mapping

FrameworkReferenceRelevance
OWASP Non-Human Identities Top 10 (2025)NHI1 Improper Offboarding, NHI2 Secret Leakage, NHI5 Overprivileged NHI, NHI7 Long-Lived Secrets, NHI9 NHI ReuseThe risks each lifecycle stage addresses
NIST SP 800-53 Rev. 5IA-4, IA-5, IA-5(13), AC-2(3), SC-12, SC-17, AU-6Identifiers, authenticator lifecycle, cached authenticator expiry, disabling accounts, key and certificate management, review
NIST CSF 2.0PR.AA-01, PR.AA-05, DE.CM-03Credential management, least privilege, monitoring of use
ISO/IEC 27001:2022 Annex AA.5.16, A.5.17, A.5.18Identity management, authentication information, access rights
MITRE ATT&CK v20T1528, T1550.001, T1552.001, T1098.001, T1078.004Theft, reuse, exposure, persistence and cloud account misuse

Common failure patterns

  • Pilot keys in production: a broad key created for a proof of concept quietly becomes the production credential.
  • Human credentials lent to agents: a developer's personal access token powers the agent, so access ends when they leave or, worse, does not (NHI10 Human Use of NHI).
  • One credential, many agents: several agents share a key, so rotation breaks all of them and logs cannot tell them apart (NHI9 NHI Reuse).
  • Directory-only offboarding: the agent is disabled in the identity platform while its SaaS refresh tokens and model API keys keep working.
  • Forgotten AI app grants: users connect AI tools to corporate accounts with broad scopes and no expiry, as in the Vercel case.
  • Sub-agents inheriting the parent's token: authority spreads with no record of who passed it on. See Delegation Chains and Attenuated Authority for AI Agents.

Practitioner checklist

  • Map every agent to every credential, issuer, scope, lifetime and sponsor.
  • Use federated or attested identity credentials for the agent itself; remove stored blueprint secrets where possible.
  • Bind tokens to one resource and sender-constrain them where issuers support it.
  • Set lifetimes per credential type and enforce refresh token policy at each issuer.
  • Trigger re-scoping or rotation on new tools, model or prompt changes, sub-agents and promotion.
  • Revoke delegated grants when users leave or withdraw consent, and reassign or suspend on sponsor departure.
  • Script revocation for every issuer and test it end to end on a test agent.
  • Review AI app grants users created and revoke unused ones.
  • Alert on any credential use by a retired or inactive agent.

Standards and references

Related NHI Mgmt Group resources: Credential Vaulting for AI Agents Guide · OWASP NHI Top 10 NHI7 Long-Lived Secrets Guide · Dynamic Secrets and Ephemeral Credentials Guide · WIMSE for AI Agents Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 27 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.