AI security · Cloud identity
Give every AI agent its own identityNot your keys. Not a shared account. Its own name in the logs.
When an agent borrows a person's credentials or a shared service account, the logs blame the wrong name, and nobody can switch off just that agent. This article explains why each agent needs its own identity, short-lived and narrowly scoped credentials, approvals for risky steps, and a clear audit trail. It then walks through what AWS, Azure and Google Cloud document today.
Imagine this: a team builds a support agent over a weekend. To get it working, an engineer pastes their own cloud access keys into its settings. Weeks later, a customer record is deleted. The audit log says the engineer did it. The engineer was asleep.
That's a scenario, not a real incident. But OWASP describes a closely related pattern, an agent acting with its maker's access, under one of its top ten risks for agentic applications. [1]
The fix isn't a new kind of magic. It's the same rule we already apply to services: every workload gets its own identity. Agents just make the rule more urgent, because they decide what to do at run time.
If you want the mechanics of swapping keys for federated tokens in CI and Kubernetes, read Delete your cloud access keys first. This article is about the agent itself.
01 / The problem
Why shouldn't an agent use your credentials?
Because then the agent is you, as far as every system can tell. OWASP's Top 10 for Agentic Applications puts this under ASI03, Identity and Privilege Abuse. It says: "Without a distinct, governed identity of its own, an agent operates in an attribution gap that makes enforcing true least privilege impossible." [1]
Three things go wrong at once:
- The logs name the wrong actor. Microsoft lists "the need to distinguish operations performed by AI agents from operations performed by workforce, customer, or workload identities" as a reason agent identities exist. [6]
- The agent gets everything you have. Your access was granted for all your work, not for one task. OWASP calls the general pattern "un-scoped privilege inheritance", where a worker "receives excessive rights". [1]
- Others can borrow it. OWASP's "Identity Sharing" example: an agent gets access "on behalf of a user, often their maker", then lets other users "leverage that identity implicitly by invoking its tools". [1]
There's also the revoke problem. If the agent misbehaves, you can't turn off its access without turning off yours.
Figure 1 · Three ways to give an agent access
- Who the log names
- The person, for everything the agent did
- Switch off just this agent?
- No. Revoking it locks the person out too
- Permissions
- Everything the person can do
- Credential lifetime
- Often long-lived keys or a saved session
03 / The credential
What should the agent hold instead of a key?
Nothing long-lived. All three clouds tell you to use short-lived credentials that the platform issues, not keys someone copies around.
- AWS. The IAM best practices page says to "require workloads to use temporary credentials with IAM roles to access AWS". Temporary credentials "can be configured to last for anywhere from a few minutes to several hours", and after they expire "AWS no longer recognizes them". [2] [3]
- Azure. Managed identities "eliminate the need for developers to manage these credentials". Microsoft adds: "Credentials aren't even accessible to you." [7]
- Google Cloud. "We recommend that you avoid using service account keys whenever possible." [10]
What if the agent runs outside that cloud? Then you use workload identity federation. The agent's platform issues a signed token, and the cloud trusts that issuer. Microsoft describes it as letting a managed identity or app registration "trust tokens from an external identity provider (IdP), such as GitHub or Google". [8] Google Cloud's version gives outside workloads access "by using federated identities instead of service account keys". [13] The earlier article on deleting cloud access keys walks through the AWS and Google Cloud versions step by step.
OWASP's guidance for agents says the same in agent terms: "Issue short-lived, narrowly scoped tokens per task", "using per-agent identities and short-lived credentials". [1]
04 / Two kinds of authority
Should the agent act as itself or as the user?
Both, depending on the task. The cloud docs use the same split, even if the names differ.
- Its own authority
- The agent uses permissions granted to its own identity. Good for shared jobs, like reading a product catalogue or writing to its own queue.
- Delegated authority
- The agent acts for one signed-in user, with that user's consent and a narrow scope. Good for "read my calendar" or "open my tickets".
Microsoft Entra describes "autonomous access", using rights given directly to the agent, and "delegated access", where the agent acts "on behalf of human users" and "the user has control over which rights are delegated". [6] Google Cloud splits its options into "user-delegated authority" and the "agent's own authority". [9] AWS AgentCore Identity supports OAuth client credentials for machine-to-machine access and the authorization code flow for "user-delegated access". [4]
Delegation is not the same as borrowing. With delegation, the agent still has its own identity, and the user's consent is scoped and recorded. AWS describes an "agent access token" that "contains both workload identity and user identity information", so downstream services can decide based on both. [5]
OWASP's LLM guidance points the same way for user data: run tools "in the context of that specific user, and with the minimum privileges necessary", for example through OAuth "with the minimum scope required". [12]
Figure 2 · A delegated request, step by step
- The user signs in and asks the agent for something
- The agent proves its own identity to an auth broker
- The user consents to a narrow scope, once
- The broker hands the agent a scoped token for that user
- The call is logged with both the agent and the user
- 1. The user's own sign-in stays with the user. The agent never sees their password or long-lived session.
- 2. On Google Cloud the agent uses its own SPIFFE ID with the auth manager; on AWS, the token vault requires proof of workload identity. [9] [4]
- 3. Consent uses standard OAuth. Both AWS and Google Cloud can show the user a sign-in and consent screen. [4] [9]
- 4. The token carries the user's consent, limited to the scope they approved. [4] [9]
- 5. Google Cloud says its logs show "both the agent's and user's identities" when an agent acts for a user. [9]
- The agent acted for the user, but it never became the user. Its own name and the user's name both reach the log.
05 / AWS
What does AWS give you for agent identity?
The foundation: IAM roles. A role gives a workload temporary credentials. On AWS compute such as EC2 or Lambda, "AWS delivers the temporary credentials of an IAM role to that compute resource". [2] Give each agent its own role.
Who started this session? If a role is assumed on someone's behalf, IAM can record a source identity. It's a value "that identifies the person or application that is performing actions in AWS", stored in AWS CloudTrail. It "can't be changed after it is set" and it carries over when one role assumes another. [11] AWS recommends it "when you want to control the identity that assumes a role". [11]
The agent-specific layer: Amazon Bedrock AgentCore Identity. AWS describes it as "an identity and credential management service designed specifically for AI agents and automated workloads". [4] The parts that matter here:
- Each agent gets "a unique identity" with its own ARN (Amazon Resource Name), held in an agent identity directory. [4]
- Agent identities "authenticate as themselves rather than impersonating users". [5]
- A token vault stores OAuth tokens and API keys. Credentials are released only to agents that "present verifiable proof of workload identity". [4]
- The vault "ensures credentials can only be accessed by the specific agent and user combination that originally obtained them". [5]
- "All operations are logged with detailed context for security monitoring and compliance reporting." [4]
06 / Azure
What does Azure give you?
The foundation: managed identities. A managed identity is assigned to an Azure compute resource, which can then get Microsoft Entra tokens "without having to manage any credentials". [7] Prefer one per agent, as chapter two explains.
The agent-specific layer: Microsoft Entra Agent ID. Microsoft defines agent identities as "identity accounts within Microsoft Entra ID that provide unique identification and authentication capabilities for AI agents". [6] Microsoft's reasoning is worth quoting: "identity models designed for human users and applications prove insufficient". [6]
- Agent identities "don't use human authentication mechanisms" such as passwords and passkeys. [6]
- When a system needs a user account, an agent identity can be paired with an agent's user account that has "a one-to-one relationship with their paired agent identity". [6]
- Organisations can "retire agents without leaving orphaned credentials or permission assignments behind". [6]
- In Copilot Studio, each new agent gets an agent identity, and "the user who created the agent is recorded as its sponsor". [6]
On availability, Microsoft says "Agent ID is available for all Microsoft Entra customers". It also says extending Entra security features to agents requires Microsoft Agent 365, which is licensed separately. [6] Check what your tenant has before you plan around a feature.
07 / Google Cloud
What does Google Cloud give you?
The foundation: dedicated service accounts. As chapter two showed, Google says to create one per application and to avoid keys. [10]
The agent-specific layer: Agent Identity. Google describes "a strongly attested, cryptographic identity for each agent that is based on the SPIFFE standard". [9] SPIFFE is an open standard for naming workloads. Google lists how it differs from a service account: agent identities "are not shared by multiple workloads by default, can't be impersonated, and don't allow developers to generate long-lived service account keys". [9]
- Each agent gets an X.509 certificate "valid for 24 hours", which Google keeps current. [9]
- Access tokens for Google Cloud are "cryptographically bound to the agent's unique X.509 certificates to prevent token theft". [9]
- You grant IAM roles to the agent's own principal identifier. A Principal Access Boundary policy can limit what it reaches "regardless of other permissions". [9]
- An auth manager brokers API keys and OAuth tokens for outside tools. [9]
- The docs list Agent Runtime, Gemini Enterprise, Cloud Run and Google Kubernetes Engine as supported services. [9]
"Deleting an agent doesn't remove the IAM bindings that reference its principal." A redeployed agent also gets "a new principal identifier", so the old grants don't carry over. [9] Put removing old bindings in your decommission steps.
Figure 3 · What each cloud documents today
- Keyless workload identity
- IAM roles with temporary credentials
- Agent-specific identity
- Amazon Bedrock AgentCore Identity
- Acting for a user
- OAuth authorization code flow; token vault per agent and user
- Who did it, in the logs
- CloudTrail with source identity; AgentCore logs every operation
08 / Scope
How narrow should an agent's permissions be?
As narrow as the task. AWS puts it simply: "grant only the permissions required to perform a task". [2] OWASP adds the agent twist: "bind permissions to subject, resource, purpose, and duration". [1]
Three habits help:
- Start from what the agent actually calls. AWS says IAM Access Analyzer can generate policies based on access activity logged in CloudTrail. [2] The post on least-privilege IAM with an agent shows one way to work from those logs.
- Put a ceiling over the grants. On Google Cloud, a Principal Access Boundary policy on an agent identity means it is "only eligible to access the resources specified in those policies". [9]
- Don't pass full access down a chain. If one agent hands work to another, OWASP says to "prevent privilege inheritance across agents unless the original intent is re-validated". [1]
One more OWASP point is easy to miss. Agents may check permissions at the start of a long task, then act hours later. OWASP calls this time-of-check to time-of-use drift: "the agent continues with outdated authorization". [1] Short-lived tokens help here too, because the agent has to come back and ask.
09 / People in the loop
Where do human approvals fit?
On the steps you can't undo. OWASP says to "require human approval for high-privilege or irreversible actions". [1] It also says to "re-verify each privileged step with a centralized policy engine". [1]
Don't confuse consent with approval. Consent happens once: a user lets the agent read their calendar. AWS AgentCore Identity has a consent portal that gathers "consent before an agent accesses a downstream resource on their behalf". [5] Google's auth manager can open "a dialog for user sign-in and consent" and lets you revoke access later. [9]
Approval happens per action: someone says yes to this refund or this deletion. Your application builds that step. A separate agent identity makes it cleaner, because the approval can name exactly which agent is asking.
An identity limits what an agent can do. It doesn't decide whether a particular action is wise. That's what approvals and policy checks are for. You need both.
10 / Proof and clean-up
What should the audit trail show, and when does it end?
The audit trail should answer two questions: which agent acted, and for whom. Each cloud has a way to show this.
- Google Cloud: "When an agent acts on a user's behalf, logs show both the agent's and user's identities." [9]
- Microsoft Entra: for agents built in Copilot Studio, authentication "is logged in Microsoft Entra ID as AI agents". [6]
- AWS: source identity in CloudTrail shows "who used the role to perform actions". [11]
Identities also need an end. Agents can be short-lived: Microsoft notes an agent "might exist for minutes during a specific task". [6] Google's service account guide says to "identify and disable unused service accounts", and to disable them before you delete them. [10] And as chapter seven showed, deleting an agent on Google Cloud leaves its IAM bindings behind until you remove them. [9]
- Never put a person's keys or session in an agent. Give each agent its own identity, one per agent, not one per team. [1] [10]
- Use platform-issued, short-lived credentials: an IAM role, a managed identity, or a dedicated service account with no keys. Use federation when the agent runs elsewhere. [2] [7] [10]
- Where your platform offers it, use the agent-specific identity: AgentCore Identity, Entra Agent ID or Google Cloud Agent Identity. [4] [6] [9]
- For user data, use delegated OAuth with the smallest scope, not a stored user credential. [6] [12]
- Require human approval for irreversible or high-privilege actions, and make sure each log line names both the agent and the user. [1] [9]
- Give every agent identity an owner, and remove its grants when the agent is retired. [6] [9]
Keep these names
A small glossary
- Identity, or principal
- The name a system uses to decide what someone or something may do, and to record what it did.
- Workload identity
- An identity for software rather than a person, such as an IAM role, a managed identity or a service account.
- Short-lived credential
- A credential that expires on its own, usually within minutes or hours, issued by the platform.
- Workload identity federation
- Letting a cloud trust a signed token from another identity provider, so no key is stored.
- Delegated access
- An agent acting for a specific user with that user's consent and a limited scope, while keeping its own identity.
- OAuth 2.0
- A standard way to grant an application limited access to a service without sharing a password.
- Source identity (AWS)
- A value set when a role is assumed that records who or what started the session, kept in CloudTrail.
- Managed identity (Azure)
- An identity Azure assigns to a resource and manages the credentials for.
- Agent ID (Microsoft Entra)
- Microsoft's product for creating and managing agent identities.
- Agent Identity (Google Cloud)
- A per-agent, SPIFFE-based identity with an auto-managed X.509 certificate and bound tokens.
- AgentCore Identity (AWS)
- An identity and credential management service for AI agents, with an agent identity directory and token vault.
Check the concept
Can you explain it back?
1. Your agent uses an engineer's access keys. Name two problems.
The logs blame the engineer, and the agent has all of the engineer's access. A third: you can't revoke the agent without locking out the engineer.
2. Why does a shared service account weaken the audit trail?
The logs show the service account's name, not which application or agent used it. Google's guide says exactly this.
3. What is the difference between delegation and borrowing a user's credentials?
With delegation the agent keeps its own identity and gets a scoped, consented token for the user. Both names can appear in the log. Borrowing leaves only the user's name.
4. You delete an agent on Google Cloud. Are its permissions gone?
No. Its IAM bindings stay in your policies as inactive grants until you remove them.
5. Consent or approval: which one covers "delete this customer record"?
Approval. Consent grants a scope once; approval checks one specific, risky action.
Continue the thread
Around the same problem
- Delete your cloud access keys. How federated tokens replace keys in CI and Kubernetes, step by step.
- Least-privilege AWS IAM with an AI agent. Narrowing an IAM policy from real activity.
- AI agent design patterns and safety. Where identity fits among the other controls around an agent.
Read further
Sources
All accessed 26 November 2026. Cloud documentation pages are live and change over time; where a page shows a "last updated" date it is noted in the fact-check record.
- OWASP Top 10 for Agentic Applications 2026: ASI03 Identity and Privilege Abuse
- AWS IAM: Security best practices in IAM
- AWS IAM: Temporary security credentials in IAM
- Amazon Bedrock AgentCore: Features of AgentCore Identity (and the AgentCore Identity overview)
- Amazon Bedrock AgentCore: AgentCore Identity terminology
- Microsoft Entra: What are agent identities
- Microsoft Entra: What are managed identities for Azure resources?
- Microsoft Entra: Workload identity federation
- Google Cloud: Agent Identity overview
- Google Cloud IAM: Best practices for using service accounts securely
- AWS IAM: Monitor and control actions taken with assumed roles (source identity)
- OWASP Top 10 for LLM Applications: LLM06:2025 Excessive Agency
- Google Cloud IAM: Workload Identity Federation
Written with AI assistance. Technical sources are listed above.