Microsoft Agent Framework — Production & Deployment Guide
Running Microsoft Agent Framework services in production: choosing a host (Foundry hosted agents, Azure Functions durable agents, Container Apps), scaling, observability, security, prompt-injection defence, evaluation in CI, resilience and cost.
Reviewed 2026-11-19 against agent-framework 1.26.0 (Python) and Microsoft.Agents.AI 1.28.0 (.NET). Language-specific detail is in the Python and .NET production guides.
Choosing a host
Section titled “Choosing a host”| Host | Python | .NET | Choose it when |
|---|---|---|---|
| Microsoft Foundry hosted agent | agent-framework-foundry-hosting: ResponsesHostServer | Microsoft.Agents.AI.Foundry.Hosting: AddFoundryResponses | You want Foundry to run, scale and secure the agent, keep conversation state, and show traces and evaluations in the portal. |
| Azure Functions durable agent | agent-framework-azurefunctions: AgentFunctionApp | Microsoft.Agents.AI.Hosting.AzureFunctions: ConfigureDurableAgents | Conversations and workflows must survive restarts and scale-in, or wait hours for a person; you want consumption billing. |
| Your own service on Container Apps, App Service or AKS | FastAPI (or similar) over agent-framework-core | ASP.NET Core with Microsoft.Agents.AI.Hosting | You need full control of the HTTP surface, networking and state stores. |
The Foundry and Azure Functions host packages are preview (.NET) or beta (Python) at the time of writing. Container images, Bicep and Kubernetes manifests for your own service are standard practice and not specific to the framework; Microsoft’s Container Apps documentation covers them.
Foundry hosted agents
Section titled “Foundry hosted agents”Python:
import os
from agent_framework import Agentfrom agent_framework.foundry import FoundryChatClient, ResponsesHostServerfrom azure.identity import DefaultAzureCredential
agent = Agent( client=FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], model=os.environ["FOUNDRY_MODEL"], credential=DefaultAzureCredential(), ), instructions="You are a friendly assistant. Keep your answers brief.", default_options={"store": False}, # the host keeps the conversation, not the model service)
if __name__ == "__main__": ResponsesHostServer(agent).run() # POST /responses.NET:
using Azure.AI.Projects;using Azure.AI.AgentServer.Core;using Azure.Identity;using Microsoft.Agents.AI;using Microsoft.Agents.AI.Foundry.Hosting;
var projectEndpoint = new Uri(Environment.GetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT")!);
AIAgent agent = new AIProjectClient(projectEndpoint, new DefaultAzureCredential()) .AsAIAgent( model: Environment.GetEnvironmentVariable("FOUNDRY_MODEL") ?? "gpt-6.1-sol", instructions: "You are a helpful assistant.", name: "my-agent");
var builder = AgentHost.CreateBuilder(args);builder.Services.AddFoundryResponses(agent);builder.RegisterProtocol("responses", endpoints => endpoints.MapFoundryResponses());
var app = builder.Build();app.Run();Durable agents on Azure Functions
Section titled “Durable agents on Azure Functions”Python (function_app.py):
import os
from agent_framework import Agentfrom agent_framework.azure import AgentFunctionAppfrom agent_framework.foundry import FoundryChatClientfrom azure.identity import DefaultAzureCredential
writer = Agent( client=FoundryChatClient( project_endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], model=os.environ["FOUNDRY_MODEL"], credential=DefaultAzureCredential(), ), name="DocumentPublisher", instructions="You write well-structured documents on a given topic.",)
app = AgentFunctionApp(agents=[writer]) # the Functions entry point (function_app.py).NET:
using Azure.AI.OpenAI;using Azure.Identity;using Microsoft.Agents.AI;using Microsoft.Agents.AI.Hosting.AzureFunctions;using Microsoft.Azure.Functions.Worker.Builder;using Microsoft.Extensions.AI;using Microsoft.Extensions.Hosting;
AIAgent agent = new AzureOpenAIClient( new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!), new DefaultAzureCredential()) .GetChatClient(Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT") ?? "gpt-6-luna") .AsIChatClient() .AsAIAgent(instructions: "You write well-structured documents on a given topic.", name: "DocumentPublisher");
using IHost app = FunctionsApplication .CreateBuilder(args) .ConfigureFunctionsWebApplication() .ConfigureDurableAgents(options => options.AddAIAgent(agent)) .Build();
app.Run();In both, each agent becomes a durable entity with its own HTTP endpoint, and conversation state lives in Durable Functions storage. Workflows can be hosted as durable orchestrations (AgentFunctionApp(workflow=...) in Python, ConfigureDurableWorkflows in .NET), so a request_info / request-port pause can last as long as the person needs.
Your own service
Section titled “Your own service”- One agent per role per process, built at start-up; one session per conversation.
- A shared session or history store (Cosmos DB or Redis) once you run more than one replica.
- Liveness probes that don’t call the model.
- Timeouts around workflow runs and a cap on concurrent model calls (below).
Prompt-injection defence
Section titled “Prompt-injection defence”Untrusted text reaches the model through user input, retrieved documents, tool results and MCP servers. Layer the defences:
- Human approval for consequential tools. Python:
@tool(approval_mode="always_require"). .NET: wrap the function inApprovalRequiredAIFunction. The run stops with an approval request and resumes when you answer on the same session. - Information-flow control (Python, experimental). FIDES (
agent_framework.security.SecureAgentConfig) labels tool output as trusted or untrusted, hides untrusted content behind variable references, and blocks privileged tools, or asks for approval, once untrusted data is in context. See the Python comprehensive guide. There is no .NET equivalent. - Prompt Shields. Azure AI Content Safety’s Prompt Shields API detects jailbreaks and indirect injection in prompts and documents; call it from agent middleware, following the content-safety middleware on the enterprise page.
- Least privilege. Scope each tool’s credentials to what it needs; never put secrets or other users’ data in instructions.
Evaluation in CI
Section titled “Evaluation in CI”Both SDKs ship a local evaluator whose checks are plain functions, so a quality gate runs as an ordinary unit test:
- Python:
evaluate_agent(agent=..., queries=[...], evaluators=LocalEvaluator(keyword_check(...), tool_called_check(...))), thenresult.assert_no_failed_items()(evaluation page). - .NET:
agent.EvaluateAsync(queries, new LocalEvaluator(EvalChecks.KeywordCheck(...), ...)), thenresults.AssertAllPassed()(.NET guide).
Keep the pull-request gate deterministic and cheap; run model-graded and Foundry evaluators nightly against recorded production conversations, and alert on regressions.
Scaling Strategies
Section titled “Scaling Strategies”Agent services are I/O-bound: almost all of a request’s time is spent waiting for the model. Two consequences follow. Scale on concurrent requests, not CPU; and remember that the model deployment’s tokens-per-minute (TPM) quota is usually the real ceiling, long before your containers are busy.
Horizontal scaling
Section titled “Horizontal scaling”In Azure Container Apps, scale on HTTP concurrency:
scale: { minReplicas: 2 // keep two warm for availability maxReplicas: 20 // cap cost, and stay inside the model's TPM quota rules: [ { name: 'http-concurrency' http: { metadata: { concurrentRequests: '20' } } } ]}On AKS, the equivalent is a KEDA ScaledObject on request rate, or an HPA on a custom “in-flight requests” metric.
Vertical sizing
Section titled “Vertical sizing”Each replica needs little CPU (it is mostly awaiting HTTP responses) but enough memory for in-flight conversations and any local tokenisation. 0.5–1 vCPU and 1–2 GiB is a sensible starting point; measure, then adjust the resources block. Container Apps does not resize a running replica — change the template and roll a new revision.
Concurrency limits inside a replica
Section titled “Concurrency limits inside a replica”Bound the number of simultaneous model calls per replica so a burst queues locally instead of tripping the model’s rate limit:
import asyncio
from agent_framework import Agent, AgentContext, AgentMiddleware
class ConcurrencyLimit(AgentMiddleware): """Allow at most `limit` agent runs at once in this process; the rest wait their turn."""
def __init__(self, limit: int) -> None: self._gate = asyncio.Semaphore(limit)
async def process(self, context: AgentContext, call_next) -> None: async with self._gate: await call_next()
limiter = ConcurrencyLimit(limit=16) # share one instance across all agents in the process# agent = Agent(client=..., instructions=..., middleware=[limiter])Caching
Section titled “Caching”Caching full answers is only safe for deterministic, non-personalised questions (FAQ-style lookups, classification of identical inputs). Do it in middleware, keyed on the agent and the exact input, and keep the TTL short. In a multi-replica deployment, use Redis rather than process memory.
import hashlibimport time
from agent_framework import AgentContext, AgentMiddleware, AgentResponse
class ResponseCache(AgentMiddleware): def __init__(self, ttl_seconds: float = 300) -> None: self.ttl = ttl_seconds self._store: dict[str, tuple[float, AgentResponse]] = {}
def _key(self, context: AgentContext) -> str: text = "\n".join(f"{m.role}:{m.text}" for m in context.messages) return hashlib.sha256(f"{context.agent.name}|{text}".encode()).hexdigest()
async def process(self, context: AgentContext, call_next) -> None: if context.session is not None or context.stream: await call_next() # never cache conversational or streaming runs return
key = self._key(context) hit = self._store.get(key) if hit and time.monotonic() - hit[0] < self.ttl: context.result = hit[1] # short-circuit: the model is not called return
await call_next() if isinstance(context.result, AgentResponse): self._store[key] = (time.monotonic(), context.result)Provider-side prompt caching (automatic on recent OpenAI and Azure OpenAI models for long, repeated prefixes) is the cheaper win: keep stable instructions and tool definitions at the start of the prompt and it applies without any code.
Monitoring & Observability
Section titled “Monitoring & Observability”Application Insights
Section titled “Application Insights”configure_azure_monitor() (package azure-monitor-opentelemetry) sets up traces, metrics and logs to Application Insights; enable_instrumentation() turns on the framework’s GenAI spans and metrics inside it.
import os
from agent_framework.observability import enable_instrumentationfrom azure.monitor.opentelemetry import configure_azure_monitor
def setup_observability() -> None: configure_azure_monitor(connection_string=os.environ["APPLICATIONINSIGHTS_CONNECTION_STRING"]) enable_instrumentation(enable_sensitive_data=False) # spans carry metadata, not prompt text
# Call once at start-up, before creating agents. Every agent.run() then produces# invoke_agent / chat / execute_tool spans and gen_ai.client.token.usage and# gen_ai.client.operation.duration metrics, tagged with agent and model names.For .NET, wrap agents with .AsBuilder().UseOpenTelemetry(sourceName) and add the Azure Monitor exporter; see the enterprise page.
Custom metrics
Section titled “Custom metrics”The built-in metrics cover model calls. Add business metrics — per-tenant usage, outcome counts — with middleware so every agent reports them the same way.
import time
from agent_framework import AgentContext, AgentMiddleware, AgentResponsefrom opentelemetry import metrics
meter = metrics.get_meter("contoso.agents")runs = meter.create_counter("agent.runs", unit="1", description="Agent runs by outcome")duration = meter.create_histogram("agent.run.duration", unit="ms", description="Agent run duration")tokens = meter.create_counter("agent.tokens", unit="1", description="Tokens used, by tenant")
class AgentMetricsMiddleware(AgentMiddleware): def __init__(self, tenant_id: str) -> None: self.tenant_id = tenant_id
async def process(self, context: AgentContext, call_next) -> None: attrs = {"agent": context.agent.name or "unnamed", "tenant": self.tenant_id} start = time.perf_counter() try: await call_next() runs.add(1, {**attrs, "outcome": "success"}) if isinstance(context.result, AgentResponse) and context.result.usage_details: tokens.add(context.result.usage_details.get("total_token_count") or 0, attrs) except Exception: runs.add(1, {**attrs, "outcome": "error"}) raise finally: duration.record((time.perf_counter() - start) * 1000, attrs)
# await agent.run(question, middleware=[AgentMetricsMiddleware(tenant_id=claims["tid"])])Log aggregation
Section titled “Log aggregation”With configure_azure_monitor() in place, standard logging records are exported too; extra= fields become custom dimensions you can query. Log identifiers and sizes, not prompt content.
import logging
logger = logging.getLogger("contoso.agents")logger.setLevel(logging.INFO)
def log_agent_execution(agent_name: str, request_id: str, result_text: str, elapsed_ms: float) -> None: logger.info( "agent run completed", extra={"agent": agent_name, "request_id": request_id, "result_length": len(result_text), "elapsed_ms": elapsed_ms}, )
def log_agent_error(agent_name: str, request_id: str, error: Exception) -> None: logger.error( "agent run failed", extra={"agent": agent_name, "request_id": request_id, "error_type": type(error).__name__}, exc_info=error, )Alerting
Section titled “Alerting”Create alerts as Azure Monitor log search alerts over the exported telemetry. Useful starting points (KQL against the Application Insights workspace):
// Error rate above 5% over 5 minutes (from the agent.runs counter above)customMetrics| where name == "agent.runs"| summarize errors = sumif(valueSum, tostring(customDimensions.outcome) == "error"), total = sum(valueSum) by bin(timestamp, 5m)| extend error_rate = errors / total| where error_rate > 0.05
// p99 model latency above 5 s (framework span)dependencies| where name startswith "chat"| summarize p99 = percentile(duration, 99) by bin(timestamp, 10m)| where p99 > 5000
// Throttling from the model endpointdependencies| where name startswith "chat" and resultCode == "429"| summarize throttled = count() by bin(timestamp, 5m)| where throttled > 10az monitor scheduled-query create \ --name agent-high-error-rate --resource-group rg-agents \ --scopes "$APP_INSIGHTS_ID" --evaluation-frequency 5m --window-size 5m \ --condition "count 'ErrorRate' > 0" \ --condition-query ErrorRate="customMetrics | where name == 'agent.runs' | summarize e=sumif(valueSum, tostring(customDimensions.outcome)=='error'), t=sum(valueSum) | where e/t > 0.05" \ --action-groups "$ACTION_GROUP_ID"Security Best Practices
Section titled “Security Best Practices”Secrets management
Section titled “Secrets management”The best secret is the one you don’t have: use managed identity for Azure OpenAI / Foundry, Cosmos DB, Storage, AI Search and Key Vault, and disable key-based auth on those resources. For the secrets that remain (third-party API keys used by tools), read them from Key Vault at start-up with the async client and cache them in memory.
from azure.identity.aio import DefaultAzureCredentialfrom azure.keyvault.secrets.aio import SecretClient
async def load_tool_secrets(vault_url: str, names: list[str]) -> dict[str, str]: """Fetch the named secrets once at start-up.""" async with DefaultAzureCredential() as credential, SecretClient(vault_url=vault_url, credential=credential) as client: return {name: (await client.get_secret(name)).value for name in names}
# secrets = await load_tool_secrets("https://your-keyvault.vault.azure.net/", ["weather-api-key"])In Container Apps you can also reference Key Vault secrets directly from the app’s secrets configuration (keyVaultUrl plus the app’s managed identity), so they arrive as environment variables without any code.
Network security
Section titled “Network security”Put the model, data and search services behind private endpoints with public network access disabled, and integrate the Container Apps environment (or AKS cluster) with the same virtual network. Then restrict inbound traffic to the front door:
resource agentNsg 'Microsoft.Network/networkSecurityGroups@2023-09-01' = { name: 'agent-framework-nsg' location: location properties: { securityRules: [ { name: 'AllowHttpsFromFrontDoor' properties: { protocol: 'Tcp' sourcePortRange: '*' destinationPortRange: '443' sourceAddressPrefix: 'AzureFrontDoor.Backend' destinationAddressPrefix: '*' access: 'Allow' priority: 100 direction: 'Inbound' } } { name: 'DenyAllInbound' properties: { protocol: '*' sourcePortRange: '*' destinationPortRange: '*' sourceAddressPrefix: '*' destinationAddressPrefix: '*' access: 'Deny' priority: 4096 direction: 'Inbound' } } ] }}Data encryption
Section titled “Data encryption”Azure services encrypt data at rest by default, and can use customer-managed keys where policy requires it. Application-level encryption is worth adding for one thing in particular: serialised conversation sessions you store yourself, which contain the full conversation.
import json
from agent_framework import AgentSessionfrom cryptography.fernet import Fernet
class EncryptedSessionStore: """Encrypts AgentSession state before it leaves the process. Keep the key in Key Vault."""
def __init__(self, key: bytes, backend: dict[str, bytes]) -> None: self._fernet = Fernet(key) self._backend = backend # stand-in for Blob Storage / Redis / Cosmos DB
def save(self, session: AgentSession) -> None: payload = json.dumps(session.to_dict()).encode() self._backend[session.session_id] = self._fernet.encrypt(payload)
def load(self, session_id: str) -> AgentSession | None: blob = self._backend.get(session_id) if blob is None: return None return AgentSession.from_dict(json.loads(self._fernet.decrypt(blob)))
# store = EncryptedSessionStore(Fernet.generate_key(), backend={})# store.save(session); restored = store.load(session.session_id)High Availability & Disaster Recovery
Section titled “High Availability & Disaster Recovery”Multi-region deployment
Section titled “Multi-region deployment”- Model endpoints: deploy the model in two regions (or use a Global / Data Zone deployment, which Azure routes across regions for you). Put Azure API Management or Front Door in front if you need explicit failover between deployments.
- Compute: run the agent service in two regions behind Azure Front Door with health probes.
- State: Cosmos DB with multi-region writes (or a failover region) for sessions and workflow checkpoints; geo-redundant storage for anything in Blob Storage.
- Targets: decide RPO and RTO explicitly. With Cosmos DB multi-region and stateless compute, an RPO of seconds and an RTO of a few minutes is realistic.
Failing over between model deployments
Section titled “Failing over between model deployments”The simplest model-level failover is two agents with the same instructions on different deployments, trying the second when the first fails with a service error:
from agent_framework import Agent, AgentResponsefrom agent_framework.exceptions import ChatClientExceptionfrom agent_framework.openai import OpenAIChatClientfrom azure.identity.aio import DefaultAzureCredential
credential = DefaultAzureCredential()INSTRUCTIONS = "You are a support assistant."
primary = Agent( client=OpenAIChatClient(model="gpt-6-luna", azure_endpoint="https://contoso-uksouth.openai.azure.com", credential=credential), name="support", instructions=INSTRUCTIONS,)secondary = Agent( client=OpenAIChatClient(model="gpt-6-luna", azure_endpoint="https://contoso-swedencentral.openai.azure.com", credential=credential), name="support", instructions=INSTRUCTIONS,)
async def run_with_failover(question: str) -> AgentResponse: try: return await primary.run(question) except ChatClientException: return await secondary.run(question)Server-side conversation state (Responses API previous_response_id, Foundry threads) lives in one region. If you need conversations to survive a regional failover, keep history client-side (in the session or a Cosmos DB history provider) rather than on the service.
Backups
Section titled “Backups”What needs backing up is the state you own: stored sessions, chat history and workflow checkpoints. Keep them in Cosmos DB with continuous backup (point-in-time restore) or in Blob Storage with soft delete and versioning, rather than writing your own backup loop. Agents themselves are code and configuration; rebuild them from source control.
Circuit breaker
Section titled “Circuit breaker”When the model endpoint is failing, a circuit breaker stops every request from waiting for its own timeout. As chat middleware it protects every agent on the client:
import time
from agent_framework import ChatContext, ChatMiddlewarefrom agent_framework.exceptions import ChatClientException
class CircuitOpenError(Exception): pass
class CircuitBreaker(ChatMiddleware): def __init__(self, failure_threshold: int = 5, reset_after_seconds: float = 60) -> None: self.failure_threshold = failure_threshold self.reset_after = reset_after_seconds self.failures = 0 self.opened_at: float | None = None
async def process(self, context: ChatContext, call_next) -> None: if self.opened_at is not None: if time.monotonic() - self.opened_at < self.reset_after: raise CircuitOpenError("model endpoint circuit is open; failing fast") self.opened_at = None # half-open: let one call through
try: await call_next() except ChatClientException: self.failures += 1 if self.failures >= self.failure_threshold: self.opened_at = time.monotonic() raise else: self.failures = 0
breaker = CircuitBreaker()# client = OpenAIChatClient(middleware=[breaker]) # every agent using this client is protectedThe OpenAI SDK underneath already retries transient errors with back-off (max_retries, default 2); the breaker is for sustained outages, where retrying only adds load.
Cost Optimisation
Section titled “Cost Optimisation”Where the money goes
Section titled “Where the money goes”For most agent services, model tokens dominate; compute, storage and networking are small by comparison. So cost work is mostly token work:
- Measure tokens per request, per agent and per tenant (the
agent.tokensmetric above, or the built-ingen_ai.client.token.usage). - Right-size the model: route simple tasks (classification, extraction, short answers) to a small model and keep the large one for reasoning.
- Trim context: long histories are re-sent every turn. Use compaction (
compaction_strategy=onAgent) or a history limit. - Use prompt caching: stable instructions and tool definitions first.
- Cap output: set
max_tokensindefault_optionswhere answers should be short.
from agent_framework import Agentfrom agent_framework.foundry import FoundryChatClientfrom azure.identity.aio import ManagedIdentityCredential
credential = ManagedIdentityCredential()
classifier = Agent( client=FoundryChatClient(model="gpt-6-luna", credential=credential), name="classifier", instructions="Classify the request as billing, technical or general. Reply with one word.", default_options={"max_tokens": 5, "temperature": 0},)
specialist = Agent( client=FoundryChatClient(model="gpt-6.1-sol", credential=credential), name="specialist", instructions="You resolve complex technical support cases.",)
async def answer(question: str) -> str: category = (await classifier.run(question)).text.strip().lower() if category == "technical": return (await specialist.run(question)).text return f"Routing to the {category} team."Then set budgets: Azure Cost Management budgets with alerts on the resource group, and per-deployment TPM quotas as a hard ceiling.
Compute
Section titled “Compute”Use the Container Apps consumption profile (scale to the minimum replica count when idle), set maxReplicas to what the model quota can actually serve, and review p95 CPU and memory monthly to right-size the container.
Performance Tuning
Section titled “Performance Tuning”Client reuse and connection pooling
Section titled “Client reuse and connection pooling”Create chat clients once per process and share them between agents; each client holds an HTTP connection pool. Creating a client (or a credential) per request defeats pooling and adds a token fetch to every call. To tune the pool, pass your own AsyncOpenAI client with a configured httpx client:
import httpxfrom agent_framework.openai import OpenAIChatClientfrom openai import AsyncOpenAI
http_client = httpx.AsyncClient( limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), timeout=httpx.Timeout(60.0, connect=5.0),)
shared_client = OpenAIChatClient( model="gpt-6-luna", async_client=AsyncOpenAI(http_client=http_client, max_retries=3),)# Every Agent(client=shared_client, ...) reuses the same pool.The same applies to Cosmos DB, AI Search and Storage clients used by tools and context providers: one instance per process.
Batch processing
Section titled “Batch processing”Run independent requests concurrently, bounded so a large batch doesn’t exceed the model’s rate limit, and collect failures instead of aborting the batch:
import asyncio
from agent_framework import Agent, AgentResponse
async def batch_agent_executions( agent: Agent, queries: list[str], max_concurrency: int = 10) -> list[AgentResponse | BaseException]: gate = asyncio.Semaphore(max_concurrency)
async def one(query: str) -> AgentResponse: async with gate: return await agent.run(query)
return await asyncio.gather(*(one(q) for q in queries), return_exceptions=True)
# results = await batch_agent_executions(agent, queries)# failed = [q for q, r in zip(queries, results) if isinstance(r, BaseException)]For large offline jobs where latency doesn’t matter, the Azure OpenAI Batch API is roughly half the price of synchronous calls; call it directly through the openai SDK rather than through an agent.
Enterprise Governance
Section titled “Enterprise Governance”Compliance and auditing
Section titled “Compliance and auditing”Audit records for agent runs and tool calls are best produced by middleware, so no code path can skip them. The enterprise page has complete AgentAuditMiddleware and ToolAuditMiddleware examples, plus Microsoft Purview integration for DLP and the Sentinel query that reads the resulting records.
For retention, send audit logs to a Log Analytics workspace with the retention your regulator requires, and archive to Storage with an immutability (WORM) policy where records must be tamper-proof.
Policy enforcement
Section titled “Policy enforcement”Use Azure Policy for the platform rules, assigned at the subscription or management group so new resources inherit them. Built-in definitions cover most of what agent workloads need:
- Azure AI services should have key access disabled (managed identity only).
- Azure AI services should restrict network access / use private link.
- Cosmos DB accounts should disable public network access.
- Require tags (
cost-centre,environment,owner) on resource groups. - Allowed locations, for data residency.
# Example: require managed identity (no keys) on Azure AI services in a subscriptionaz policy assignment create \ --name deny-ai-local-auth \ --display-name "Azure AI services should have key access disabled" \ --policy 71ef260a-8f18-47b7-abcb-62d0673d94dc \ --scope "/subscriptions/$SUBSCRIPTION_ID"Policies inside the agent — which tools a user may call, which models a team may use, per-tenant budgets — are middleware; see Enterprise Governance.
For code-level detail, see:
- Comprehensive guide — core concepts
- Recipes — practical examples
- Diagrams — architecture visualisations