Build an AI App on Azure: Services, Setup, Costs
Building an AI app on Azure means combining a model endpoint (usually Azure OpenAI Service), a hosting layer (App Service, Functions, or Container Apps), and supporting infrastructure like Key Vault for secrets and Azure Monitor for logging. There's no single "Azure AI app" product — you assemble a small stack of managed services around whichever model provider you're using.
The important thing to know upfront: Azure OpenAI Service only hosts OpenAI's models (GPT-4o, GPT-4, GPT-3.5). It does not host Claude. If your app needs Claude specifically — for its tool-use behavior, longer context handling, or writing style — you'll be calling the Anthropic API directly, either from your Azure-hosted backend or through a proxy like SubToAPI that gives you a standard HTTPS endpoint, API keys, and usage metadata without extra infrastructure to run. Everything else in your architecture (hosting, auth, storage, monitoring) still lives on Azure regardless of which model you call.
The core building blocks
A typical AI app on Azure uses some subset of these services:
- Azure OpenAI Service — hosted GPT models with enterprise SLAs, private networking, and content filtering. Use this if you're building on OpenAI models specifically.
- Azure AI Search — vector and hybrid search for retrieval-augmented generation (RAG). Pairs with any model provider, including Claude.
- App Service / Azure Functions / Container Apps — where your backend logic runs: routing requests, assembling prompts, handling streaming responses.
- Azure Key Vault — stores API keys and secrets so they never sit in code or environment files checked into git.
- Azure Monitor / Application Insights — request logging, latency tracking, and error alerting for your AI endpoints.
- Azure Cosmos DB or Azure SQL — conversation history, user data, and application state.
None of these are mandatory. A minimal AI app can run as a single Azure Function calling a model API and returning JSON. The full stack matters once you have real users, need retrieval over your own documents, or have compliance requirements around data residency.
A minimal setup
If you're starting from zero and just want a working endpoint, the fastest path looks like this:
- Provision a hosting target (Azure Functions is the cheapest starting point for low-traffic apps).
- Store your model provider's API key in Key Vault, not in app settings.
- Write a thin handler that receives a request, calls the model API, and streams or returns the response.
- Add Application Insights for basic request logging from day one — debugging a production issue without logs is painful.
Here's what that handler looks like when calling a model API from an Azure Function, using SubToAPI as the model endpoint (works identically if you swap in Azure OpenAI's endpoint and auth header):
const { app } = require('@azure/functions');
app.http('chat', {
methods: ['POST'],
authLevel: 'anonymous',
handler: async (request) => {
const body = await request.json();
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: body.messages
})
});
const data = await response.json();
return { jsonBody: data };
}
});
The pattern is the same whether you're calling Azure OpenAI, the Anthropic API, or a proxy in front of either: your Azure Function handles auth, request validation, and business logic; the model call itself is a single HTTP request. Full request and response shapes are in the docs and the quickstart if you want to see the whole flow end to end.
Where teams get stuck
A few recurring problems come up when building AI apps on Azure specifically:
Streaming through Azure Functions. Consumption-plan Functions don't handle long-lived streaming connections well by default — you often need Premium plan or a different hosting model (App Service, Container Apps) if you want token-by-token streaming to the client. Check your plan's timeout and connection behavior before committing to an architecture. See streaming for how the underlying SSE format works regardless of host.
Mixing model providers. If part of your app uses GPT models via Azure OpenAI and another part needs Claude for tool-calling or long-context tasks, you end up managing two SDKs, two billing dashboards, and two sets of rate limits. Routing the Claude side through a single endpoint like SubToAPI keeps that part of your stack consistent — one API key format, one streaming implementation, one usage dashboard — while Azure OpenAI stays as is for the GPT side.
Tool use and function calling. Both OpenAI and Claude support structured tool calls, but the request/response schemas differ. If you're building agent-style features, decide early which model's tool-calling format you're standardizing your backend around. Tool use docs cover Claude's format if that's the one you pick.
Cost visibility. Azure Cost Management shows spend at the resource level, but per-user or per-feature attribution usually requires you to log token counts yourself. Most API responses include usage data — capture it in your logging pipeline from the start rather than retrofitting it later.
Choosing your model layer
If your app is squarely built around GPT models and you're already deep in the Azure ecosystem (Active Directory auth, VNet integration, data residency requirements), Azure OpenAI Service is the straightforward choice — it's the same models with Azure's compliance wrapper.
If you specifically want Claude's models — for longer context windows, different reasoning behavior, or its tool-use format — you're calling outside Azure OpenAI regardless of how you host your app. In that case, a service like SubToAPI removes the setup overhead: you get an API key, streaming support, and usage metadata without managing your own proxy or billing reconciliation. Sign up and get a working key in a few minutes at /signup, and compare plans at /pricing if you're estimating cost for a team.
questions
Does Azure OpenAI Service support Claude models? No. Azure OpenAI Service only hosts OpenAI's models. To use Claude in an Azure-hosted app, call the Anthropic API directly or through a proxy service, while keeping your hosting, auth, and storage on Azure.
What's the cheapest way to host an AI app on Azure? Azure Functions on a consumption plan for low-traffic apps, moving to Premium or App Service once you need streaming responses or predictable latency under load.
Do I need Azure AI Search to build an AI app? Only if you're doing retrieval-augmented generation over your own documents. Simple chat or completion apps that just call a model API don't need a search layer.