Build AI Apps and Agents with Azure: A Practical Guide
Building AI apps and agents with Azure means combining a handful of Microsoft services — Azure AI Foundry, Azure OpenAI Service, Azure AI Agent Service, and Azure AI Search — into a pipeline that takes a user request, runs it through a model, optionally calls tools or retrieves data, and returns a response. Azure gives you the infrastructure (compute, identity, networking, monitoring) and the model access; you write the orchestration logic on top.
If you're evaluating Azure for this, the short answer is: it works well if you're already inside the Microsoft ecosystem (Entra ID, Azure DevOps, existing enterprise agreements) and you need enterprise-grade compliance and data residency guarantees. It's more setup-heavy than a standalone API if you just want to ship a prototype fast. Below is a practical breakdown of what's involved and where the friction usually shows up.
The core Azure services for AI apps
Azure AI Foundry is the umbrella portal for building generative AI apps. It replaced the older Azure AI Studio branding and gives you a project workspace where you manage model deployments, prompt flows, evaluation, and agent definitions in one place.
Azure OpenAI Service is where you actually deploy and call models (GPT-4o, GPT-4, GPT-3.5, embeddings models). You provision a resource, create a deployment for a specific model, and get an endpoint plus API key or Entra ID token.
Azure AI Agent Service sits on top of this and adds agent-specific primitives: tool calling, code interpreter, file search, and thread/run management similar to OpenAI's Assistants API. This is the piece most relevant if you're building something that needs to plan multi-step tasks, not just answer single prompts.
Azure AI Search is the retrieval layer — vector search plus keyword search — that most production agents use for RAG (retrieval-augmented generation) so responses are grounded in your own data instead of the model's training data alone.
A typical build flow
- Create an Azure AI Foundry project and connect it to an Azure OpenAI resource.
- Deploy a model (e.g.
gpt-4o) and note the deployment name — this is what you call in code, not the model name itself. - Wire up authentication, either an API key or Entra ID with managed identity (recommended for production).
- If you're building an agent, define tools — function calling schemas, code interpreter, or a search index connection.
- Build the orchestration loop: send the user message, check if the model wants to call a tool, execute the tool, send the result back, repeat until you get a final answer.
- Add observability — Azure Monitor and Application Insights integrate with AI Foundry for tracing token usage, latency, and errors.
A minimal chat call against Azure OpenAI looks like this:
const response = await fetch(
`${endpoint}/openai/deployments/${deployment}/chat/completions?api-version=2024-06-01`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"api-key": process.env.AZURE_OPENAI_KEY,
},
body: JSON.stringify({
messages: [{ role: "user", content: "Summarize this ticket." }],
max_tokens: 500,
}),
}
);
For agents with tool calling, you add a tools array with JSON schema definitions and handle the tool_calls response by executing your own functions and looping the result back into the conversation — the same pattern as most function-calling APIs, just with Azure's specific deployment-name routing.
Where the friction actually is
Azure's model is powerful but it front-loads a lot of decisions: resource groups, regional availability (not every model is available in every region), quota requests for higher throughput, and RBAC configuration before you can even make your first call. None of that is wrong — it's what enterprises need — but it slows down the "I just want to test an agent idea" phase considerably.
The other common issue: teams building agents often want more than one model family. GPT-4o for speed, Claude for long-context reasoning or coding tasks, maybe an open model for cost-sensitive batch jobs. Azure OpenAI Service only gives you Azure-hosted OpenAI models. If your agent architecture wants to route between providers, you end up managing separate SDKs, separate key management, and separate billing dashboards, which adds real maintenance overhead once you're past the prototype.
This is the gap tools like SubToAPI are built for. If part of your app or agent needs Claude specifically — for tool use, long-context document work, or coding subagents — SubToAPI turns an existing Claude subscription into a standard HTTPS API with sub_live_... application keys, streaming, tool use, and usage metadata, so you're not standing up a second cloud account just to call one more model. You can run your Azure-hosted agent as the orchestrator and call out to Claude through SubToAPI for the steps where it performs best, without touching Azure's IAM or quota system for that piece.
const response = await fetch("https://api.subtoapi.app/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SUBTOAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "claude-sonnet-4",
max_tokens: 1024,
messages: [{ role: "user", content: "Refactor this function for clarity." }],
}),
});
That's a single call, no deployment names, no region quota request. The quickstart covers setup, /docs/messages covers the full request format, /docs/streaming covers server-sent events for token-by-token output, and /docs/tools covers function/tool calling for building agents that need Claude to invoke your own functions.
Choosing an approach
- Pure Azure makes sense if your org already runs on Azure, you need data residency guarantees, and you're comfortable with the setup overhead for compliance benefits.
- Azure + external model APIs makes sense if your agent needs multiple model strengths and you don't want every model access managed through Azure IAM.
- A single API layer (SubToAPI for Claude, direct APIs for others) makes sense for small teams or solo builders who want to ship an agent this week, not after a cloud governance review.
Most production agents end up as a mix: Azure or another cloud for infra and orchestration, direct API calls for the models that do specific jobs best. Plans start at pricing if you want to add Claude access to that mix, with a free trial available at signup.
Questions
Do I need an Azure subscription to use Azure AI Foundry? Yes. Azure AI Foundry projects run inside an Azure subscription and require an Azure OpenAI resource (which itself requires approval in some regions) before you can deploy models.
Can I build an agent with Azure that also calls Claude? Yes — nothing stops you from calling any HTTPS API from your Azure-hosted app or function. You'd handle Claude calls through Anthropic's API directly or through a service like SubToAPI, and keep Azure OpenAI Service for the models it hosts.
Is Azure AI Agent Service the same as building an agent from scratch? No. It gives you managed primitives — threads, runs, tool execution, code interpreter — similar to OpenAI's Assistants API. You still write the tool logic and business rules, but you don't have to build the conversation state management yourself.