Now-a-days, every org runs to build AI agents. Every time they plan to build any agent, there will be one question that runs in their mind: Is my agent secure?
Welcome to the blog! I’m Sandeep, here to explain how you can secure and manage your agent lifecycle end-to-end.
Once we reach to the end of the blog, you will be able to secure and govern not one, but 1,000s of agents at a time!
The Tectonic Shift: Why Autonomous Agents Break Traditional Security
For the past two years, enterprise AI was primarily conversational: prompt in, completion out. If a response had an issue, the blast radius was limited to what appeared on a single user’s browser screen.
Autonomous AI agents have shattered that comfort zone. Today’s AI agents do not merely suggest text; they plan, reason, invoke custom APIs, query enterprise databases, trigger financial transactions, modify customer records in CRM/ERP systems, and communicate with peer agents.
When you move from single-turn chat to multi-agent autonomy, the threat surface multiplies exponentially:
- Autonomous Tool Execution: If an agent suffers from a Prompt Injection, it can be manipulated into issuing unauthorized database writes or malicious API calls.
- Identity Ambiguity: Are tool calls executed under the developer’s credentials, a generic shared service principal, or the logged-in user?
- Data Exfiltration & PII Leakage: How do you ensure proprietary enterprise IP or customer PII isn’t ingested into unverified agent reasoning steps or sent to third-party endpoints?
- Agent Sprawl: With dozens of agile engineering teams spinning up agents across disparate Azure subscriptions, who maintains the single source of truth for what agents exist and what they are allowed to do?
The Core Enterprise Challenge: Decoupling the Control Plane from the Data Plane
Developers need agility in the Data Plane (the execution runtime where prompts, models, vector searches, and business tools run). Meanwhile, CISOs, SecOps, and Platform Engineering teams require strict centralized sovereignty in the Control Plane (identity, policy guardrails, inventory catalog, audit trails, and observability). The Microsoft / Azure AI Foundry Control Plane provides this exact enterprise boundary.
The Architectural Blueprint: Foundry Control Plane vs. Data Plane
To govern 1,000s of agents without turning the security team into a delivery bottleneck, modern enterprise architecture establishes a clear separation between the Centralized Governance Plane and the Distributed Execution Plane.
Enterprise AI Foundry Governance Architecture
FOUNDRY CONTROL PLANE (Centralized Enterprise Governance & Administration)
Security: Identity & IAM
• Microsoft Entra Agent ID
• Agent Identity Blueprints
• On-Behalf-Of (OBO) Flow
• Granular Azure RBAC
Compliance: Guardrails
• Azure AI Content Safety
• Prompt Injection Shields
• Real-time PII Scrubbing
• Token Quotas & Rate Limits
Fleet Management
• Global Agent Discovery
• Cross-Project Inventory
• Full Model & Tool Lineage
• Emergency Kill-Switches
Observability & Evals
• OpenTelemetry Agent Tracing
• Reasoning Step Capture
• Continuous Groundedness Eval
• Departmental Cost Attribution
FOUNDRY DATA PLANE (Runtime Execution & Tool Invocations)
HR Benefits Agent
Identity: agent-hr-prod-01 (Entra)
Tools: Workday API, SharePoint RAG
Status: Active & Governed
Customer Support Agent
Identity: agent-support-prod-04 (Entra)
Tools: Dynamics 365, Zendesk
Status: Active & Governed
Financial Reporting Agent
Identity: agent-fin-prod-02 (Entra)
Tools: PowerBI, Azure SQL Warehouse
Status: Active & Governed
Now, let’s dissect the four indispensable capabilities of the Foundry Control Plane that turn this architecture into reality.
i) Security: Identity and Access
The single biggest architectural flaw in early enterprise agent deployments was using shared service accounts or hardcoded API keys. When an agent used a monolithic service principal, three catastrophic security failures occurred:
- Excessive Permissions: The service principal had access to everything the team might need, completely violating the Principle of Least Privilege.
- Loss of Attribution: If a record in Salesforce or a table in Azure SQL was corrupted or leaked, the audit log simply stated: “Updated by AppServicePrincipal”. There was zero visibility into which user prompted the action or which agent executed the tool call.
- Credential Infiltration: Hardcoding secrets in system prompts, configuration JSONs, or code repos made credential leakage trivial.
Enter Microsoft Entra Agent ID
Microsoft Foundry bridges this gap by introducing Microsoft Entra Agent ID. Instead of treating AI agents as standard applications or opaque service principals, Entra Agent ID treats autonomous agents as first-class non-human directory identities.
Core Mechanics of Entra Agent ID
- Agent Identity Blueprints: Platform administrators define an Identity Blueprint, a governance template defining permitted API scopes, baseline credentials, and operational boundaries.
- Child Instance Provisioning: When a new agent instance is deployed across environments (Dev, Test, Prod), Entra spawns a distinct child identity tied to that blueprint.
- On-Behalf-Of (OBO) Token Delegation (RFC 8693): When a human user interacts with an agent, the agent doesn’t impersonate the user blindly. Instead, it exchanges tokens via a secure OAuth token exchange flow. The resulting access token encapsulates both the User Subject and the Agent Actor Facet (the
actclaim).
ii) Compliance: Guardrails, Policies, and Controls
In an enterprise, an agent cannot be a “black box” that responds however the underlying LLM pleases. You must guarantee that every inbound input and outbound response passes through strict regulatory, brand, and safety filters.
The Foundry Control Plane enforces policy guardrails at the network request path, functioning hand-in-hand with an AI Gateway (such as Azure API Management) and Azure AI Content Safety.
Prompt Injection Shields
Protects against both Direct Jailbreaks (users deliberately trying to override system prompts) and Indirect Prompt Injections (malicious payloads embedded in external PDFs, third-party emails, or unvetted web search results). Foundry inspects unstructured inputs before the model interprets them.
Real-Time PII & Sensitive Data Masking
In-flight scanning automatically detects and redacts SSNs, credit card numbers, private API tokens, email addresses, and medical identifiers before prompts are passed to the model or returned to end-users, ensuring full compliance with GDPR, HIPAA, and PCI-DSS.
Groundedness & Hallucination Checks
Employs small, specialized evaluator models to perform real-time verification: Are the claims in the agent’s output strictly supported by the retrieved enterprise documents? If groundedness drops below your defined threshold, the control plane blocks the response or triggers a graceful fallback.
Request-Path Rate & Token Quotas
Through AI Gateway policies, the control plane enforces hard limits on Tokens-Per-Minute (TPM) and requests-per-agent. When recursive reasoning loops or malicious queries threaten to drain budgets, the gateway returns programmatic 429 Too Many Requests or 403 Forbidden status codes.
iii) Fleet Management: Agent Discovery, Inventory, and Activity
Imagine your organization has 300 engineering squads. Squad A builds an agent for IT ticketing; Squad B builds an agent for SAP procurement; Squad C builds one for customer telemetry.
Without centralized fleet management, this results in Agent Sprawl, a catastrophic landscape of unmonitored shadow AI. Nobody knows how many agents are currently running, which foundation models they connect to, which API tools they can call, or which versions are vulnerable to new zero-day jailbreaks.
A Single Pane of Glass Across All Projects
The Foundry Control Plane Fleet Catalog acts as the central registry for every agent deployed across any Azure AI Foundry project, workspace, or subscription.
- Unified Discovery: Automatically indexes all first-party custom agents, prompt-based copilots, and third-party partner agents.
- Full Lineage & Provenance: Tracks exactly which LLM deployment (e.g., GPT-4o, Claude 3.5, Phi-3), system prompt commit, vector index, and API tools are bound to each agent release.
- Fleet-Wide Emergency Kill-Switch: If a model provider experiences a vulnerability or an agent displays anomalous tool behavior, SecOps can toggle the agent’s state to
Blockedwith a single click, instantly severing its gateway routes across all applications.
iv) Observability: Traces, Evals, and Metrics
Traditional Application Performance Monitoring (APM) tools measure CPU spikes, memory consumption, and HTTP 200 vs 500 codes. For AI agents, traditional APM is completely blind.
An agent can return an HTTP 200 status code while giving a completely fabricated, hallucinatory answer that costs your company $100,000 in bad procurement decisions. Or an agent can enter an infinite reasoning loop, burning 2,000,000 tokens before crashing.
1. OpenTelemetry Distributed Tracing for Agentic Steps
The Foundry Control Plane standardizes on OpenTelemetry (OTel) to instrument every stage of an agent’s reasoning loop:
2. Continuous Automated Evals
You cannot manage what you do not measure. The Control Plane runs automated evaluation benchmarks both in the CI/CD pipeline and against sampling streams in production:
- Groundedness Score: Measures how faithfully the output is rooted in your enterprise knowledge base (scale 1-5).
- Relevance Score: Verifies whether the agent addressed the user’s specific intent without wandering.
- Task Success Rate: Measures whether the agent accomplished its multi-step objective within permitted iterations.
- Automated Red-Teaming: Regularly bombards agents with synthetic adversarial prompts to detect emerging jailbreak vectors before malicious actors find them.
Comparison: Ungoverned Agent Estate vs. Governed Foundry Fleet
To see the immense value of an enterprise control plane in perspective, let’s compare how an organization operates with and without it:
The 5-Stage Enterprise Agent Governance Lifecycle Framework
How do you roll this out across your enterprise? Here is the step-by-step framework we recommend for enterprise architecture and platform engineering teams:
Phase 1: Inception & Identity Blueprinting
Define the agent’s business intent, risk category, and tool requirements. Create an Agent Identity Blueprint in Microsoft Entra ID with least-privilege API scopes. Never share identities between agents.
Phase 2: Sandboxed Development & Tool Mocking
Developers prototype the agent within an isolated Foundry Project sandbox. Tool integrations run against mocked data or read-only staging stores. Baseline OpenTelemetry tracing is enabled from day one.
Phase 3: Automated CI/CD Testing & Red-Teaming Gate
Prior to merging or staging, automated evaluation suites run against the agent release. The build fails if groundedness scores fall below 4.0/5.0, if prompt injection tests succeed, or if PII leaks into reasoning spans.
Phase 4: Registration in Foundry Fleet Catalog
The agent is registered in the enterprise catalog with full lineage records (model version, prompts, vector stores). Endpoints are routed through the AI Gateway with TPM limits and Content Safety guardrails bound.
Phase 5: Continuous Runtime Governance & Access Reviews
Live production telemetry streams into Microsoft Defender and Purview. Regular access reviews certify that the agent’s tool permissions remain necessary. Anomaly detection flags drift, and kill-switches remain active.
Enterprise Readiness Checklist: Is Your Agent Estate Governed?
Before authorizing any AI agent for production deployment, review this 10-point checklist with your security and platform engineering teams:
- Dedicated Identity: Does the agent have its own Microsoft Entra Agent ID (no shared secrets or personal accounts)?
- On-Behalf-Of Delegation: Are downstream tools accessed via RFC 8693 token exchange preserving the user’s audit footprint?
- Prompt Injection Shields: Are direct and indirect prompt injection filters active on every unstructured input?
- PII Sanitization: Is real-time data loss prevention (DLP) stripping sensitive customer identifiers before model invocation?
- Groundedness Verification: Is an automated evaluator checking that responses adhere strictly to enterprise context?
- ✅ Token & Rate Quotas: Does the AI Gateway enforce Token-Per-Minute (TPM) limits to prevent financial denial-of-wallet?
- Central Catalog Registration: Is the agent registered in the Foundry Fleet Catalog with complete tool and model lineage?
- OpenTelemetry Instrumentation: Are all reasoning steps, tool calls, and latencies visible in distributed traces?
- Kill-Switch Operational: Has SecOps verified that the agent can be transitioned to
Blockedin under 30 seconds? - Periodic Access Reviews: Are Entra ID Governance access certifications scheduled for the agent’s permissions?
Conclusion: Building Fearless AI at Enterprise Scale
Key Takeaway from Me is:
The goal of AI governance is not to slow developers down; it is to give your organization the confidence to move at breakneck speed. When your developers know that guardrails, identity boundaries, and observability are baked into the Foundry Control Plane, they can build bold, high-value autonomous agents without fear of catastrophic security breaches.
By uniting Security (Entra Agent ID), Compliance (Guardrails & Policies), Fleet Management (Discovery & Lineage), and Observability (Traces & Continuous Evals), your enterprise can confidently govern not just one agent, but a flourishing fleet of thousands.
Have questions about implementing the Microsoft AI Foundry Control Plane or securing your agentic workflows? Reach out to our enterprise AI team at Canarys to architect your production-ready AI governance strategy.