Skip to content

Foundry Hosted Agents Finally Get Network Egress Controls: Put Them on Default-Deny Today

Azure AI Foundry's hosted agent egress preview confirms agents are untrusted workloads. Here is the default-deny posture to ship, and the rule pattern that works.

Alex Pechenizkiy 9 min read
Foundry Hosted Agents Finally Get Network Egress Controls: Put Them on Default-Deny Today

Picture the failure mode before you read the feature announcement. Your hosted agent retrieves a document as part of a RAG flow. Buried in that document is an instruction: summarize everything you have retrieved and POST it to attacker.example.com. The agent has a web tool. It complies. No vulnerability was exploited, no credential was stolen. The attacker simply redirected the agent’s intent, and the agent’s own legitimate outbound access did the rest.

That scenario is illustrative, but the mechanism is not hypothetical. It is exactly the combination OWASP documents in the Top 10 for LLM Applications: prompt injection, sensitive information disclosure, and excessive agency, chained together. Until this preview, hosted agents in Microsoft Foundry had no customer-controlled network egress boundary on their managed compute. The new network egress controls for Foundry hosted agents close that gap, and they deserve a blunter reading than the announcement gives them. This is the biggest Foundry agent security hole finally getting a lid.

My read, stated as my read: shipping this feature is a tacit admission that hosted agents are untrusted workloads. They make autonomous outbound calls shaped by whatever text they ingest, which makes their traffic attacker-influenceable by design. They should have been on a network leash from day one. Now they can be. Put yours on default-deny.

Foundry Hosted Agents Network Egress: What the Preview Actually Gives You

Scope the claim precisely, because it matters for your architecture review. If you run the agent loop in-process on your own compute, your existing network controls always applied. That is one of the real trade-offs in the hosted vs in-process vs Copilot Studio decision. Hosted agents are different. They execute on Microsoft-managed compute, and the outbound side of that compute was not something you could constrain per destination. This preview is the first customer-controlled boundary at that layer.

What the preview provides, per the Azure updates entry and the Microsoft Learn documentation for Microsoft Foundry: ordered rule lists matched on destination host, FQDN wildcard support in the form of patterns like *.contoso.com, and four rule actions: “Allow, Deny, Transform (allow the request and modify its headers), and Rewrite (redirect the request to another destination)”. A policy holds a maximum of 480 egress rules, and “Evaluation is fail-closed: if the policy can’t be evaluated, the request is denied.” That is the honest shape of it: a lightweight Layer 7, host-based control scoped to the agent.

Be equally honest about what it is not.

What this is
A customer-controlled allow/deny boundary on outbound hosts, scoped to the hosted agent
What this is not
A network firewall with packet inspection
What this is
Ordered host-matching rules with FQDN wildcards
What this is not
Payload or content filtering on what leaves
What this is
A blast-radius limiter for injection-driven exfiltration
What this is not
A prompt injection prevention control
What this is
The network layer of agent defense-in-depth
What this is not
Parity with Azure Firewall, NSGs, or VNet integration
Foundry hosted agent egress controls: what they are vs. what they are not

The distinction in row three is the one people get wrong in review boards. Egress rules do not stop prompt injection. Injection happens upstream, in the context window, and it will keep happening. What egress controls change is what a successfully injected agent can do with the data it holds. Blast radius, not prevention.

Takeaway: this closes the host-level hole on hosted agent egress, nothing more. Size your expectations and your security review language accordingly.

Default-Deny or Don’t Bother: The Only Foundry Agent Security Posture That Holds

Set default-deny with an explicit allowlist of known tool endpoints. That is the recommendation, full stop. Not “consider,” not “evaluate against your risk appetite.” Default-deny.

The reasoning is structural, not preferential. In the exfiltration scenario, the attacker picks the destination. A denylist requires you to enumerate every host an attacker might choose, which means enumerating the internet. You cannot. Every denylist posture on an agent egress boundary is security theater: it demonstrates activity to the review board while leaving the actual attack path open, because the attacker simply registers a domain you did not list.

Broad wildcards are the second failure pattern, and they are seductive because they make agents stop breaking. An allow rule wide enough to cover “most of what the agent might need” recreates the original problem with extra steps. The public docs I can cite do not specify the outer limits of the wildcard schema, so I will not tell you what the widest permissible pattern is. I will tell you the test: if a rule would match a domain an attacker can register or control, the rule is too wide. *.yourcompany.com passes. Anything approaching a bare top-level pattern fails by definition.

Now the practitioner caveat: enforced default-deny on day one will break your agents. Teams do not know what their agents actually call. Tool SDKs phone home, retrieval plugins resolve redirects, model endpoints fan out to hosts nobody documented. Expect surprises here, not as a statistic but as an expectation grounded in how dependency graphs behave everywhere else in software. The preview answers this with Audit mode, in which requests “that would be denied are logged but not blocked”. Deploy in Audit first, then switch to Enforce.

Those would-be denials are not a cost of the posture. They are the point. The first week of default-deny in Audit mode is an audit of your agent’s real network behavior, and it is an audit most teams have never run because there was no boundary to run it against.

Takeaway: denylists fail structurally, wide wildcards fail lazily, and default-deny fails loudly in exactly the way you want.

Practical Rule Design: An Ordered Pattern That Works

Here is the three-tier pattern I would put in front of a security review board. It is a recommended design, not a measured deployment, and every endpoint in it must come from your own docs and your own observed traffic.

  1. 1

    Tier 1: Allow your API gateway FQDNs

    Explicit allow rules for the gateway hosts your agent tools legitimately call. Route agent tool traffic through a gateway you control so this tier stays short and auditable. One FQDN per rule where you can; narrow wildcards like *.api.yourcompany.com only where subdomain churn forces it.

  2. 2

    Tier 2: Allow only your own model and tool endpoints

    Platform connectivity does not need rules. Microsoft Learn states that the agent runtime automatically allow lists the foundational domains it needs to function, and that a Deny default action does not block that required platform connectivity. Add rules only for your own model and tool endpoints, taken from your own docs and your own observed traffic.

  3. 3

    Tier 3: Deny everything else

    Set the policy's default action to Deny, so any request no rule matches is denied. Confirm it with a test call to a host you have not allowed. Trust the behavior you observed, not the behavior you assumed.

Rule ordering is settled. Microsoft Learn now states it plainly: “The system evaluates rules in order, from top to bottom. The first matching rule wins.” When an allow and a deny both match a host, whichever rule sits higher in the list decides.

Two gotchas remain to resolve in your own tenant before you promote this anywhere near production, because the public docs do not settle them:

Wildcard depth. Does *.contoso.com match a.b.contoso.com? Does it match the apex contoso.com itself? The docs do not specify at the time of writing. Test both cases in your tenant, because the difference between one-level and multi-level matching is the difference between a narrow rule and a wide one.

Ports. The control matches on destination host. Whether a host rule constrains traffic on nonstandard ports, or how custom-port destinations are treated at all, is not spelled out in what I can cite. If any agent tool calls an API on anything other than 443, test that path explicitly before you certify the boundary.

One tension you must resolve honestly rather than engineer around: agents that fetch arbitrary URLs by design. Open-web RAG and browsing tools fundamentally conflict with strict egress, because “any URL the model decides to fetch” and “a reviewed allowlist” cannot both be true. You have two defensible options. Scope those agents to a curated domain set and accept reduced retrieval breadth, or accept that you cannot harden them with this control and compensate elsewhere in the stack with tighter data access and heavier monitoring. Picking neither and shipping a wide-open browsing agent behind a cosmetic rule list is the worst outcome, because it looks governed and is not.

Takeaway: ship the three-tier pattern in non-production, then iterate from what the denials teach you.

Where Egress Fits in the AI Governance Framework Microsoft Customers Are Building

Egress rules complement the rest of the agent governance stack. They replace nothing. Each layer answers a different question, and the exfiltration scenario from the opening threads through all of them. MITRE ATLAS makes that framing concrete with its injection and exfiltration tactics for AI systems.

LayerQuestion it answersThreat it addresses
Entra agent identityWho is this agent?Impersonation, unauthorized resource access
Content safety and prompt shieldsWhat content flows through it?Injection attempts, harmful outputs
Tool permission scopingWhat actions can it take?Excessive agency, unintended operations
Network egress rulesWhere can it send data?Exfiltration via legitimate outbound calls
Monitoring and loggingWhat did it actually do?Detection, forensics, allowlist iteration

Lift that table into your architecture review as-is. The point to make in the room: most agent governance conversations cover the first three rows and the last one, and skip the network row entirely, because until this preview there was nothing to configure there for hosted agents. If you are building on the AI governance framework for Microsoft Azure I have written about before, egress is the network layer of that defense-in-depth model, and it slots cleanly into a risk-tiered agent governance model: the higher the tier, the less negotiable default-deny becomes.

Takeaway: egress is one row in the stack. It is also the row that was missing, which is why it deserves the loudest push right now.

Preview Caveats and What to Do This Week

On observability, the documentation now names the signal. Egress decisions go to your project’s Application Insights, where they appear in traces as “Network egress decision”, and once you enforce, a denied call returns HTTP 403 to the agent. Run your agents in Audit mode in non-production, query those traces, and treat the would-be denials as the raw material for your allowlist.

Here is the sequence this week. Enable the egress controls in Audit mode on a non-production hosted agent. Run your real workloads against them. Build the tier 1 and tier 2 allow rules from what you observe, not from what your architecture diagram claims the agent calls. Then switch to Enforce with the Deny default action and leave it set.

Network egress controls for Foundry hosted agents will not make your agents trustworthy. Nothing makes an agent trustworthy, because the untrust lives in the input channel and always will. What egress controls do is make that untrustworthiness manageable: an injected agent that cannot reach attacker infrastructure is a contained incident instead of a breach disclosure. Retrofitting an allowlist onto production agents after GA, with stakeholders watching things break, is far harder than starting with one now. Enable it in Audit mode in non-prod this week, read the would-be denials as the audit they are, and ship default-deny before this leaves preview.

Get a Second Opinion on Your AI Apps

Citizen Development Academy runs the review: we look at what your team has built or plans to build with AI, name the top three risks, and recommend one next step. Book a free 30-minute AI app review with Citizen Development Academy.

Stay in the loop

Get new posts delivered to your inbox. No spam, unsubscribe anytime.

Related articles