Skip to content
Code To Cloud
7 min read

Microsoft Foundry Security Best Practices

Securing Microsoft Foundry: network isolation, Entra ID and keyless access, Foundry roles, guardrails, keys, Azure Policy and Defender, from Microsoft Learn.

By Kevin Evans

"Azure AI Foundry security best practices" is a common search, along with "security baseline", "network security" and "agent security". Foundry is where many teams build their first agents on Azure, so it's often the first AI service a security team has to sign off. Here's what to check, from Microsoft's own documentation.

A naming note: Microsoft now calls it Microsoft Foundry. "Azure AI Foundry" is the older name.

What's Inside

  • Network isolation for the Foundry resource and for agents
  • Identity: Entra ID, keys and the Foundry roles
  • Guardrails and Prompt Shields
  • Data use, encryption, Azure Policy and Defender for Cloud

1. Network: close the front door, then the back

Inbound. A Foundry resource's public network access can be all networks, selected IP addresses, or disabled (private endpoint only). (1) Microsoft's security baseline notes that disabling public network access is supported but not on by default. (2)

Outbound, for agents. Foundry Agent Service can inject agents into your own virtual network. The subnet must be delegated to Microsoft.App/environments, be /27 or larger, and serve one Foundry resource. (3) Microsoft's wording: "Standard setups require you to Bring Your Own (BYO) resources so that all agent data stays in your Azure tenant": your own Storage, Azure AI Search and Cosmos DB.

Two catches to plan for:

  • Outbound networking can't be added to an existing deployment. Decide before you build.
  • Some agent tools, including Bing, web search and SharePoint, use public endpoints.

2. Identity: Entra ID, not keys

Microsoft's RBAC page puts the risk plainly: "If you use key-based authentication instead, the key grants full access without role restrictions." (4) Use Microsoft Entra ID and managed identities, and disable key access. Azure Policy has a built-in for it (see section 5).

Use the Foundry roles, which replaced the older "Azure AI" role names:

  • Foundry User: least privilege for people building.
  • Foundry Agent Consumer: can call agent endpoints only.
  • Foundry Project Manager, Foundry Account Owner and Foundry Owner for administration.

Microsoft advises against the Azure AI Developer role for Foundry work, since it's scoped to Azure Machine Learning workspaces and hubs. Also note that agent-scoped role assignments currently control endpoint access only; files aren't isolated per caller.

3. Guardrails and Prompt Shields

What used to be called content filters are now guardrails, powered by Azure AI Content Safety. They cover hate, sexual, violence and self-harm at adjustable severity levels. (5) Prompt Shields detects direct prompt attacks and indirect attacks hidden in documents or tool output, and each can be set to annotate or block. For agents that read email, web pages or files, turn on indirect attack detection.

4. Data use and encryption

  • Training. Microsoft says prompts and completions "are NOT used to train any generative AI foundation models without your permission or instruction." (6)
  • Location. Prompts are processed in the geography you choose, except for Global and DataZone deployments. Pick the deployment type deliberately if residency matters to you.
  • Abuse monitoring. The same page explains when prompts may be stored for human review. Read it with your privacy team.
  • Encryption. Data at rest is encrypted by default, and customer-managed keys in Key Vault are supported but not on by default. Some preview features may not support them.

5. Enforce it with Azure Policy

Microsoft publishes built-in policies for Foundry (7), none of them on by default. The ones we'd start with:

  • Key access disabled (local authentication).
  • Public network access disabled, and private endpoints in place.
  • Managed identity in use.
  • Diagnostic logs enabled.
  • "Foundry model deployments should only use approved models".

Policy turns this checklist from a one-off review into a rule every new project inherits.

6. Watch it with Defender for Cloud

Defender for AI Services "identifies threats to generative AI applications in real time", such as jailbreak attempts, data leakage and credential theft, and feeds Defender XDR. (8) Enabling it for a subscription needs the Owner role.

One caution: Microsoft's Foundry security baseline page says it "may contain outdated guidance". Use it as a starting point, and check each control against the current product pages.

Where we come in

These controls are much easier to set up before the first agent ships than after. Our Agent Platform Readiness Review checks a Foundry environment against this list and Microsoft's AI landing zone guidance. For the network and identity layer underneath, see the Azure AI Landing Zone Readiness Checklist. Send us a message to start.

In a regulated industry? See OSFI E-23 and AI on Azure and PCI DSS and AI on Azure.

Kevin Evans

Kevin Evans, founder of Code To Cloud Founder, Code To Cloud Inc. Kevin Evans is a Microsoft MVP for Azure. He and the Code To Cloud team build Azure platforms for enterprise and mid-market teams, from developer platforms to AI agents in production. He spent nearly five years at Microsoft, rising to Senior Solutions Engineer, and is a CNCF Ambassador and Calgary chapter lead, based in the Calgary area, Alberta. More about Kevin

Frequently Asked Questions

Is Azure AI Foundry the same as Microsoft Foundry?

Yes. Microsoft's documentation now uses the name Microsoft Foundry. People still search for Azure AI Foundry, which is the older name.

Does Microsoft use our Foundry prompts to train models?

Microsoft's data privacy page says prompts and completions are not used to train any generative AI foundation models without your permission or instruction.

Can Foundry agents run in our own virtual network?

Yes. Foundry Agent Service supports injecting agents into your own virtual network, with a delegated subnet of /27 or larger. The standard setup brings your own Storage, Azure AI Search and Cosmos DB so that agent data stays in your Azure tenant. Outbound networking can't be added to an existing deployment.

Which role should developers have in Foundry?

Microsoft lists Foundry User as the least-privileged role for builders. Microsoft advises against the Azure AI Developer role for Foundry work, since that role is scoped to Azure Machine Learning workspaces and hubs.

Sources

Checked against Microsoft Learn on 3 December 2026.

  1. Configure network isolation for Microsoft Foundry
  2. Microsoft Foundry security baseline
  3. Virtual networks for Foundry Agent Service
  4. Role-based access control for Microsoft Foundry
  5. Guardrails (content filtering)
  6. Data, privacy and security for Azure OpenAI in Foundry
  7. Built-in policy definitions for Foundry Tools
  8. AI threat protection in Defender for Cloud

See where your agentic AI governance stands.

Take the free five-minute scorecard first, no email needed. When you want to talk it through, send us a message: no pitch, just a straight conversation.

Also free: Agent Platform Production Checklist · AI Landing Zone Readiness Checklist