Build AI Apps on Azure: A Decision Framework
Building AI apps on Azure isn't really a technology question — it's a sequence of decisions. Which model service do you call, how do you handle streaming and tool use, where does your app logic live, and how do you avoid locking your entire product into one vendor's SDK. This article walks through that decision sequence rather than a step-by-step tutorial, because the tutorial part is easy: the hard part is picking the right defaults before you write code.
If you're searching for how to build AI apps on Azure, you're probably choosing between Azure OpenAI Service, Azure AI Foundry, and a patchwork of your own API calls. All three can work. The right choice depends on how much of Azure's ecosystem (identity, networking, compliance boundaries) your app actually needs versus how much it's just using Azure as a place to run containers while calling AI models over HTTPS.
Start with what your app actually needs from Azure
Before picking a specific AI service, separate two concerns:
- Infrastructure needs: compute (App Service, Container Apps, AKS), storage, networking, identity (Entra ID), and compliance boundaries your customers require.
- Model access needs: which LLM providers you want to call, what latency and streaming behavior you need, and whether you need tool use / function calling.
A lot of teams conflate these and end up hard-wiring Azure OpenAI Service into their app because it's convenient, then discover six months later they want to offer a Claude-based tier or a specific model a customer asked for, and the integration is tangled through their whole codebase.
The cleaner pattern: build your app against a stable internal interface (a thin wrapper around "send messages, get completion, optionally stream") and let the specific provider be a configuration detail, not an architectural one.
Picking an AI service inside Azure
Azure OpenAI Service is the default for teams that want GPT-family models with Azure's networking and compliance story attached. Good fit if your customers require data residency guarantees or you're already deep into Entra ID-based auth.
Azure AI Foundry is the newer, broader surface — it adds model catalog access (including some non-OpenAI models), agent orchestration primitives, and evaluation tooling. Use it if you want a single pane for experimentation across multiple models before committing to one.
Bring-your-own model access is the third path: your app runs on Azure infrastructure, but you call model APIs directly over HTTPS from your backend, independent of Azure's AI product lineup. This is common when the model you actually want — Claude, for instance — isn't natively part of the Azure AI catalog, or when you want a provider-agnostic client library you fully control.
None of these are mutually exclusive. Plenty of production apps run compute on Azure and call multiple model providers directly, treating Azure purely as the hosting layer.
Architecture pattern that scales without rewrites
A pattern that holds up as usage grows:
- API gateway layer — your Azure Container App or Function receives requests from your frontend, handles auth, rate limiting, and request validation.
- Model routing layer — a small service or module that decides which model provider to call based on tenant config, feature flags, or cost tier.
- Provider clients — thin, isolated clients per provider (Azure OpenAI SDK, direct HTTPS calls to other APIs) that all conform to the same internal request/response shape.
- Usage and logging layer — capture tokens, latency, and errors per request so you can bill accurately and debug model-specific issues.
This keeps your business logic (prompts, tool definitions, conversation state) independent of any single vendor's SDK quirks, which matters a lot once you're running A/B tests between models or need a fallback provider during an outage.
If part of your model routing includes Claude, SubToAPI turns an existing Claude subscription into a standard HTTPS API with application keys, streaming, and tool use — so your Azure-hosted app can call it with the same request pattern you use for other providers, without building a separate auth flow. It fits into step 3 above as just another provider client:
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: "Summarize this ticket." }]
})
});
Details on request shape and auth are in the quickstart and messages docs.
Streaming and tool use in an Azure-hosted backend
Two things trip up teams building on Azure specifically:
- Streaming through Azure infrastructure: if you're proxying model responses through an Azure Function or App Service, make sure your gateway doesn't buffer the whole response before forwarding it. Server-Sent Events or chunked transfer need to pass through untouched, or your "real-time" chat feels laggy. See streaming for the event format if you're integrating Claude-based responses this way.
- Tool use across providers: if your app supports function calling with more than one model provider, normalize tool schemas at the routing layer rather than duplicating tool definitions per provider SDK. The tools docs cover the request/response shape for tool calls if Claude is one of your providers.
Cost planning without guessing
Azure compute costs (Container Apps, AKS, storage) are usually predictable and small relative to model token costs once you're at any real scale. Budget for token usage first — it's the line item that grows with your user base, not your infrastructure choices. Track it per tenant and per feature from day one, since retrofitting usage attribution into an app that's already in production is painful.
If you're using SubToAPI as a provider, pricing is flat per seat (Solo €9, Team €19/seat, Scale €49/seat) rather than metered token billing, which makes forecasting simpler for teams that want predictable line items alongside their Azure compute spend. A free trial at signup lets you test the integration pattern before committing.
Bottom line
Building AI apps on Azure works best when you treat Azure as your infrastructure layer and keep model access as a swappable, provider-agnostic component. Pick Azure OpenAI Service or Azure AI Foundry if you need Azure's native compliance and catalog story; call other providers directly over HTTPS when you need a specific model or want provider flexibility. Either way, the architecture that survives growth is the one where your prompts and business logic never know which vendor is answering them.
FAQs
Do I need Azure OpenAI Service to build AI apps on Azure? No. You can host your app on Azure infrastructure (App Service, Container Apps, AKS) and call any model provider's API directly over HTTPS. Azure OpenAI Service is convenient but not required.
What's the difference between Azure OpenAI Service and Azure AI Foundry? Azure OpenAI Service focuses on GPT-family models with Azure's compliance and networking wrapper. Azure AI Foundry is a broader platform with a wider model catalog, evaluation tools, and agent orchestration primitives.
Can I use Claude in an Azure-hosted app? Yes, by calling Claude's API directly or through a service like SubToAPI, which exposes an existing Claude subscription as a standard HTTPS API your Azure backend can call like any other provider.