How to Secure Homegrown AI Agents on Amazon Bedrock AgentCore and Azure AI Foundry
Set up identity and tool permissions on both clouds, then verify that the same support agent can read a ticket and needs approval to change it.

Rushali
2026 State of Agentic AI Security
How ready is your organization to secure AI agents?
3 quick questions. See how you compare to other security leaders.
A support agent reads a ticket, then bumps its priority, all from one chat window. To the user it feels like one conversation. To the ticket service it’s two very different requests: one reads a record, the other changes it. They should not share a permission.
Securing homegrown agents on Amazon Bedrock AgentCore and Azure AI Foundry comes down to a few moves. Scope each agent’s workload identity. Authorize every tool call before it runs. Record the outcome at the service that actually performs the action. Add content guardrails on the paths that support them. Then prove it in staging: an allowed read succeeds, and an unapproved write leaves the record exactly as it was.
We’ll use a ticketing agent throughout to keep this concrete. The workflow runs against a fictional staging ticket, and the expected results double as acceptance criteria for your own deployment.
Which controls secure AI agents on Bedrock AgentCore and Azure AI Foundry?
Begin with the action that changes a record, and answer four questions about it. Who asked for it? Which identity reached the tool? Where was the policy decision made? What did the service actually do? Those four questions work for the same application on either cloud.

Control | Amazon Bedrock AgentCore | Azure AI Foundry hosted agent | What to verify |
Identity | Scope the Runtime execution role and configure inbound invocation authorization. | Identify the Microsoft Entra identity used by the hosted agent. Scope its Azure RBAC assignments and the tool’s own permissions. | Trace the requesting user and the identity the tool actually received. |
Tool authorization | Apply AgentCore Policy at AgentCore Gateway for routed calls. Enforce permissions at the downstream service wherever it accepts writes. | Enforce action permissions in the tool API or an inline gateway. Apply the approval rule where the write is accepted. | Record a permit or deny decision and check whether the ticket changed. |
Network access | Restrict runtime access to the destinations needed by the workflow. | Configure supported private connectivity and egress controls for the hosted deployment. | Confirm the agent reaches approved destinations and record the result for a disallowed destination. |
Content screening | Use Amazon Bedrock Guardrails at configured model boundaries or eligible Gateway policy checks. | Use Foundry guardrails, including Prompt Shields where supported by the deployment. | Identify the inspected payload and the control that produced the verdict. |
Audit | Use AgentCore telemetry in CloudWatch and the ticket service audit record. | Use Foundry tracing with Application Insights and the ticket service audit record. | Correlate the invocation, tool decision, and service outcome. |
Before touching any controls, take inventory. List the agent’s entry point, its workload identity, every tool endpoint, and whether each operation reads or writes. Don’t forget retrieval, background jobs, and tools that sit behind a gateway. For every operation that can change state, name the team that owns the decision and the system that records the result. That list is your test scope. A passing Gateway test proves that route and nothing else, so any route missing from the list needs to be added.
Record which system owns each decision
Keep the inventory small and specific to the agent you’re shipping: entry point, owner, runtime identity, tools, data sources. For each tool, mark whether it reads, writes, or kicks off something that keeps running after the conversation ends. Write down the credential the downstream service actually sees, and which service does the permission check. In most teams this information is spread across deployment settings, gateway configs, and application code. Pull it into one place before you start reviewing privileges.
The ticket workflow shows why this changes design decisions. The read only needs to fetch a ticket the caller is allowed to see. The write has to confirm permission to change that specific ticket and, where policy requires it, a matching approval. A shared integration identity can tell the ticket service that the agent called. It can’t tell it which person asked. If the access decision depends on the individual requester, the application has to pass verifiable user context along.
Queued writes need extra thought. If the workflow hands a change to a worker for later, decide what that worker checks at execution time. Pass the exact operation, record, requester, and approval scope through the handoff. Decide what happens if permission was revoked or the approval expired in the meantime, and test that case in staging. A request that was valid when submitted can be invalid by the time the worker picks it up.

Secure the tool path on Amazon Bedrock AgentCore
Scope the runtime role and separate reads from writes
The agent’s Runtime execution role comes first. Grant it access to the AWS resources the ticket workflow needs, and nothing beyond that, then confirm which identity it presents when it calls the tool. Review inbound invocation authorization as a separate exercise. Who may run the agent and who may change a ticket are two different access questions, and they need two different answers.
Split the lookup and the priority change into separate tool operations. For calls that pass through AgentCore Gateway, use AgentCore Policy to evaluate each tool request before it executes. At the ticket API, require authorization for the write and check any approval against that specific ticket and that specific change. Apply the same API rule to every other approved route that can reach the write endpoint.
Tie AgentCore Runtime sessions to the caller
If the agent keeps conversation state, your application should bind each runtime session to the authenticated caller and check ownership on every later request. Runtime session isolation gives each session its own execution boundary. It doesn’t decide who’s allowed to continue a given session. That’s your application’s job. Log the invoking identity and the runtime session ID together so an operator can trace any request back to where it started.
Walk through every supported invocation path. If a gateway sits in front of the runtime, confirm that only the expected callers and services can reach it. For the ticket API, give the runtime network access to that one destination and keep authorization at the service boundary. Network access means the runtime can reach the service. The ticket service still decides which records and operations the caller may use.
Put content screening and tool authorization on the right paths
Apply Amazon Bedrock Guardrails wherever you need content inspected. AgentCore Gateway Policy can also call supported guardrail checks. Either way, record which path produced the content verdict and which control decided whether the tool action could go ahead. They are often different components.
For the staging agent, capture the Gateway policy decision whenever a request takes that route. With observability configured, AgentCore can send logs or spans to CloudWatch. Line those up against the ticket service history. The agent can reply cheerfully while its tool call was denied, so always check the service outcome on its own.
Verify how failures appear on the AWS path
On the Gateway route, capture one known allow and one known deny while the ticket API is healthy. Record the Gateway operation and look at the AgentCore Policy spans or metrics in CloudWatch. Gateway application logs give you request context. Policy observability gives you the authorization evidence. Join them on the request or trace ID where your deployment exposes one. Next, simulate a service error in staging and compare the records. Someone investigating later should be able to tell a Gateway denial from a downstream failure at a glance.
If you add a request or response interceptor, write down which traffic it evaluates and what the caller sees when it can’t return a decision. AWS supports different interception behavior on different routes, and Akto documents separate coverage for MCP and for supported buffered HTTP targets. Test in the same mode you’ll run in production, and record MCP and streaming results separately.
Keep content tests and authorization tests apart. A tool call with perfectly normal arguments can still exceed the caller’s permissions. A permitted lookup can still return data you want inspected before the agent uses it. Run one staging check per condition, and log each decision at the component that made it.
Secure a hosted agent on Azure AI Foundry
Verify which identity reaches the tool
This section uses a hosted agent in Foundry Agent Service. Find out which Microsoft Entra identity the deployed agent uses for each resource, and scope its Azure RBAC assignments to only what it needs. Then go to the ticket API in staging. Check the identity that actually arrives, and confirm the service can resolve the user context it needs to make the approval decision.
The workload identity may be allowed to call the tickets API while only certain users may approve a write. That rule belongs in the API, or in an inline gateway on the execution path. If you require approval, bind it to the ticket and the proposed priority, and check it again at the moment the tool executes. Set up the private networking and egress controls available for hosted deployments, then test which approved destinations the agent can really reach.
Trace the tool attempt and confirm the service outcome
Connect Application Insights to the Foundry project and make sure your tracing captures the tool operation you care about. Start with a plain lookup. Find its trace and check the tool span for whatever arguments or identifiers your telemetry keeps. If an identifier is enough to investigate, keep the raw ticket text out of the trace.
Use Foundry guardrails, such as Prompt Shields, at the supported points where the agent handles untrusted content. Check tool authorization and ticket history separately from that. The proof that a priority changed is the application’s audit log, not the guardrail verdict.
Check Foundry networking separately from tool permissions
A private connection to the Foundry resource controls access to that resource. It says nothing about the hosted agent’s outbound path to each tool. Work out which calls stay on the approved private route, which destinations need an egress rule, and which credentials each tool sees. Then run a lookup from the deployed agent to confirm the path your code really takes.
Check who can read the connected telemetry and what the traces hold. For the ticket scenario, the team can usually investigate with just the operation name, a scoped ticket ID, the policy result, and a trace ID. Leave full ticket contents and raw prompts out of the evidence pack unless a specific investigation needs them and you can handle them under your data policy.
Confirm the hosted agent and tool agree on user context
Map the identities before you assign roles. Who can invoke the hosted agent? Which identity does the agent use for its project and connected resources? What does the ticket service verify for each operation? Within a single invocation, these can all be different. Check both the Foundry configuration and the authenticated request that actually lands at the tool.
For the read test, use a ticket the requester is allowed to see. For a separate access check, pick a staging ticket outside that user’s scope and confirm the tool refuses the read. For the write test, scope the approval to the target ticket and the requested priority. If an approved operation can be retried, make sure a retry neither creates a second change nor carries the approval over to a different record.
When something goes wrong with the hosted agent, start from the Foundry trace in Application Insights and follow the tool span to the service record. Both sides should agree on the operation and the result. If only one side carries a usable identifier, add or propagate a correlation ID your team can query, without storing whole prompts or ticket bodies.
Then look at who can open those traces. The team running the agent probably needs operation, identity, and status. Incident evidence with sensitive attributes may belong to a much smaller group. Settle which fields each group needs before you turn on verbose tracing in production.
The same applies to data kept outside the trace. If the agent stores conversation history or tool results, record which component owns that data, who can read it back, and when it’s deleted. A tool might return details the caller was entitled to see during the session. Save the full response, and you’ve created a new access decision for everyone who reads that stored context later. Review retention and access rules for both the ticket system and the agent’s stored state.
How do you verify both deployments in staging?
Run the same four checks on AgentCore and on Foundry. You need one dedicated staging ticket set to priority Normal, one user with read access, and a second user who is authorized to approve priority changes. Reset the ticket between any runs that change it.
Allow a read. Have the reader ask for a summary of the ticket. Confirm the lookup succeeds, returns only the intended ticket, and that you can trace the identity the ticket API saw.
Deny an unapproved write. Have the reader ask to raise the ticket to High. Capture the deny or approval-pending decision. Then open the ticket directly and confirm it still says Normal.
Allow the approved change. Have the authorized user approve the move to High for that ticket. Check the approval record and confirm the ticket history shows exactly one intended change.
Repeat for each supported route. If the agent can reach the tool by more than one approved path, run the denied-write check on each one. Note where authorization happened and which monitoring surface got the event.
Treat the table below as your acceptance criteria. Each row is the expected outcome for the fictional staging ticket.
Test | Expected policy evidence | Expected ticket-service evidence |
Reader requests a summary | A permitted lookup tied to the intended reader and agent | Lookup completes. Priority stays Normal. |
Reader requests a priority change without approval | A deny or pending decision associated with the requested write | Priority stays Normal. No successful update appears in the history. |
Authorized user approves exactly that change | An approval record tied to the target ticket and requested priority | One approved change appears in the audit history. Priority is High. |
A separate approved tool route receives an unapproved write | The route identifies the enforcing service and records its decision | No additional update occurs. |
Be wary of a run where the chat reply looks fine but the ticket service shows nothing. Check the application trace and the service record before you call it a pass. A missing update could mean the request was denied, the service was down, or the call never reached the tool at all. Each one has a different fix, so you need to know which it was.

Keep a small evidence record for every run: agent and request IDs, tool and ticket IDs, the policy outcome, and the actual ticket state. On AWS, compare the configured Gateway or Runtime telemetry against the service record. On Azure, compare the Foundry trace in Application Insights against it. If you can’t link the two, add correlation before you call the workflow release-ready.
Add two tests that catch misleading passes
First, an expired or revoked approval. Record the approval and its scope, invalidate it in staging, then confirm the tool refuses the write when execution is attempted. Note whether the refusal came from the gateway, the tool API, or some other enforcing service, and check the service history for the final state.
Second, a timeout. Point the tool at a staging endpoint that returns an error. The failed call should show up in telemetry, and the application should report an error or an unknown result honestly. If retries are part of the workflow, confirm they respect authorization and never repeat a write that already went through. Keep this result separate from the denied-write test. An operator reading the evidence should be able to tell whether the service was down, the request was rejected, or the action completed.
Make the evidence usable after release
For every tested route, keep a short release record: agent version, environment, tool route, control owner, policy version where you have one, trace ID, and the expected versus observed result. When the action touches an external system, store the decision and the service record next to any screenshot of the chat.
Rerun the checks any time a change adds a tool, widens an identity’s access, switches a network path, or moves enforcement to a different component. Moving an update from a gateway route to a background worker, for example, changes where permission has to be enforced and where the outcome gets recorded. Retest the new path even if the chat looks exactly the same.
If the agent is already live, pick a low-impact workflow and start with an approved staging reproduction, or a controlled production check run through your change process. Keep the test data isolated and agree on what success looks like before you start. The approval rule should have a single clear owner, and the team should know how to switch off the write path if the control misbehaves.
Where does Akto fit alongside native cloud controls?
On AWS, Akto can apply inline policies to supported MCP tool calls that pass through a configured AgentCore Gateway. The interceptor can evaluate a supported call before the target runs, and can inspect supported tool results, including redaction where configured. In staging, confirm the request really went through the configured route, review Akto’s decision, and check the ticket history. Coverage for supported buffered HTTP targets is different, so read the setup doc before making claims about those routes. Akto AgentCore integration
On Azure, Akto imports supported Foundry Agent Service agents and analyzes the interactions captured through the configured monitoring path. Start with one known interaction and compare the Foundry trace with what shows up in Akto. Whether a write was actually stopped is settled by the tool or gateway decision and the ticket history. Akto Azure AI Foundry integration
If you’re still working out whether native capabilities cover the workflow, see the Bedrock and Azure AI Foundry guardrails comparison. For the wider release review, use the homegrown agent security criteria and the production guardrail validation guide.
Before release, give every tested path an owner. The cloud platform team owns runtime identity and networking. The tool owner owns the record-level authorization rule and the audit trail. Security reviews both records against the same test expectations. Whenever the agent gains a tool, rerun the denied-write check on the new path before it gets production access.
Decide what Akto evidence should accompany the cloud logs
On AgentCore, a useful evidence set has three parts: the tool route, Akto’s policy decision for the supported intercepted call, and the ticket service outcome. If you’ve turned on response inspection or redaction, also check what the agent actually receives on that path. Record which requests and responses are covered, so an operator in the middle of an investigation knows what traffic was evaluated.
On Foundry, use a known tool interaction to check the monitoring path end to end. Start with a recognizable test ID and compare what appears in Application Insights, the ticket service, and Akto. If a field shows up in one system and not another, note the gap in the release record. Then assign a source of truth for each question: agent activity, authorization decision, and downstream effect.
One rule holds on both clouds. Keep the tool’s decision and the service outcome together. When an investigation starts from a chat message or an alert, that pair is what tells you what the agent was allowed to do, and what it actually did.
Frequently asked questions
Does AgentCore Policy apply to every tool my agent can invoke?
No. AgentCore Policy evaluates applicable requests that are routed through AgentCore Gateway. Direct API calls and other approved gateway paths need their own inventory. For each route, identify the component that authorizes the action and the service that can confirm the outcome, and include it in staging evidence before you rely on the control in production.
Do Foundry guardrails authorize writes to an internal tool?
No. Foundry guardrails screen content at supported intervention points. When a hosted agent writes to an internal ticket API, enforce the permission at the API itself or at an inline gateway that controls the write. Keep the service audit record so you can confirm which identity requested the write and whether it ran.
Can Akto enforce the same control on both integrations?
Not in the same way. Akto can enforce policies inline on supported MCP traffic through a configured AgentCore Gateway. On Azure, the Foundry connector imports supported agents and monitors captured interactions. To confirm a blocked Foundry tool action, correlate the captured activity with the deny or approval decision from the enforcing component and with the downstream record.
What should I retain to investigate an agent action later?
Keep the requester and workload identities, the correlation ID, the tool name, the target record, the decision, and the downstream outcome. For writes that need approval, add the approver and the approval scope. Apply your retention and redaction rules to that record, and restrict access to any sensitive attributes.
Experience enterprise-grade Agentic Security solution
