Capacity Is Part of the Design
Take a typical case, made up for illustration. A support assistant ran fine for months on a single Standard deployment. Then a launch email went out, traffic jumped six-fold, and about one request in five came back with a 429. The client retried each one immediately, several times, so throttling got worse instead of better.
Azure OpenAI gives you OpenAI models inside your own subscription: private networking, Entra ID, regional control and content filtering. It also makes you think about things the public API hides, such as deployments, quotas, provisioned throughput and regional availability. Below is the setup that holds up at a launch: identity-based auth, capacity planning, retries that back off, and content filters handled as normal results.
- You stored an Azure OpenAI key in an env var and your security review failed
- You called the deployment "gpt-5.6-sol" in code and the call returned 404
- You hit throughput limits during a demo and didn't know whether to ask for quota or buy PTUs
- You can't explain what the content filter actually filters
Deployments, Quotas and Throughput
Azure OpenAI exposes OpenAI's models (the GPT-5.x family up to GPT-5.6 Sol / Terra / Luna, embeddings, image and audio models) through Azure-managed endpoints. Three concepts you must internalize:
- Resource — your Azure OpenAI account in a region. Has its own endpoint URL and quota allocation.
- Deployment — a named instance of a specific model + version. Your code calls the deployment name, not the model name.
- Capacity — Standard (pay-per-token, shared pool) or Provisioned (PTUs, dedicated throughput, committed cost).
flowchart LR
A["App<br/>(Managed Identity)"] -->|Entra ID token| B["Azure OpenAI Resource<br/>(eastus2)"]
B --> C{"Routing"}
C -->|deployment: chat-prod| D["GPT-5.6 Sol<br/>Standard or PTU"]
C -->|deployment: chat-cheap| E["GPT-5.6 Luna"]
C -->|deployment: embed-prod| F["text-embedding-3-large"]
B --> G["Content Filter<br/>(prompt + completion)"]
B --> H["Diagnostic Logs →<br/>Log Analytics"]
style B fill:#0078D4,color:#fff,stroke:#005a9e
style G fill:#dc2626,color:#fff,stroke:#b91c1c
A Production Setup
Step 1: Provision with Bicep — keys disabled, Entra only
// infra/openai.bicep
param location string = resourceGroup().location
param resourceName string
resource openai 'Microsoft.CognitiveServices/accounts@2024-10-01' = {
name: resourceName
location: location
kind: 'OpenAI'
sku: { name: 'S0' }
properties: {
customSubDomainName: resourceName
publicNetworkAccess: 'Disabled' // require private endpoint
disableLocalAuth: true // KEYS OFF — Entra only
networkAcls: { defaultAction: 'Deny', ipRules: [], virtualNetworkRules: [] }
}
identity: { type: 'SystemAssigned' }
}
resource chatModel 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = {
parent: openai
name: 'chat-prod' // ← your code uses THIS name
sku: { name: 'GlobalStandard', capacity: 50 } // 50 K TPM
properties: {
model: { format: 'OpenAI', name: 'gpt-5.6-sol', version: '2026-07-09' }
raiPolicyName: 'Microsoft.DefaultV2'
}
}
output endpoint string = openai.properties.endpointStep 2: Grant the app role assignment, not a key
// Cognitive Services OpenAI User — call deployments
param appPrincipalId string // object ID of your app's managed identity
var openAiUserRoleId = '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd'
resource appRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
scope: openai
name: guid(openai.id, appPrincipalId, openAiUserRoleId)
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions', openAiUserRoleId)
principalId: appPrincipalId // your app's managed identity
principalType: 'ServicePrincipal'
}
}Step 3: Call from .NET 10 with DefaultAzureCredential
// Program.cs
using Azure.AI.OpenAI;
using Azure.AI.OpenAI.Chat;
using Azure.Identity;
using OpenAI.Chat;
var endpoint = new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!);
var azureClient = new AzureOpenAIClient(endpoint, new DefaultAzureCredential());
var chat = azureClient.GetChatClient(deploymentName: "chat-prod"); // ← deployment name
// GPT-5.6 Sol is a reasoning model: no Temperature/TopP, and the token cap must be
// sent as max_completion_tokens. AzureOpenAIClient sends max_tokens unless told otherwise.
var options = new ChatCompletionOptions { MaxOutputTokenCount = 2000 };
#pragma warning disable AOAI001
options.SetNewMaxCompletionTokensPropertyEnabled();
#pragma warning restore AOAI001
var completion = await chat.CompleteChatAsync(
[
new SystemChatMessage("You are a concise assistant."),
new UserChatMessage("Give me one tip on Azure OpenAI quotas.")
],
options);
Console.WriteLine(completion.Value.Content[0].Text);Step 4: Stream tokens with the official Python SDK against Azure
# pip install openai azure-identity
import os
from openai import AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
token_provider = get_bearer_token_provider(
DefaultAzureCredential(),
"https://cognitiveservices.azure.com/.default",
)
client = AzureOpenAI(
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
azure_ad_token_provider=token_provider,
api_version="2025-01-01-preview",
)
stream = client.chat.completions.create(
model="chat-prod", # ← deployment name
messages=[{"role": "user", "content": "Stream me a haiku about Bicep."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Step 5: Standard vs PTU — pick by latency variance, not just cost
Standard / GlobalStandard
• Pay per input/output token (priced per 1M tokens)
• Shared capacity → P99 latency varies under noisy-neighbor load
• Quota measured in TPM (tokens/min) per deployment
• Best: low-volume APIs, batch jobs, dev/test, spiky traffic
Provisioned (PTU / Provisioned-Managed)
• Buy units of throughput (PTU). PTUs aren't tied to a model; how many TPM
a PTU delivers depends on the model and on your input/output mix
• Predictable latency within what you bought; over 100% utilization → 429
• Hourly billing per PTU, or Azure Reservations (monthly/yearly) at a discount
• Best: chat with strict SLA, real-time agents, high-volume RAG
My rule of thumb: if user-facing latency has a hard p99 target and traffic has a
steady base, price PTUs for that base. If batch work can wait, Standard (or Batch) is cheaper.Step 6: Content filter — what it actually does
Text models run prompts and completions through the content filters, but the categories differ by direction: hate, sexual, violence and self-harm apply to both, jailbreak detection applies to prompts, and protected-material detection applies to completions. By default the four harm categories block medium and high severity. Custom policies let you tune severity thresholds per category or add blocklists. You also have two failure paths to handle. A blocked prompt fails with HTTP 400 and code content_filter, so a branch on finish_reason never sees it. A blocked completion returns 200 with finish_reason: "content_filter", and possibly partial text. Log both, and don't silently retry.
using System.ClientModel; // Azure.AI.OpenAI 2.x throws ClientResultException
using Azure.AI.OpenAI.Chat; // GetResponseContentFilterResult()
try
{
var resp = await chat.CompleteChatAsync(messages);
if (resp.Value.FinishReason == ChatFinishReason.ContentFilter)
{
#pragma warning disable AOAI001
var filter = resp.Value.GetResponseContentFilterResult();
#pragma warning restore AOAI001
logger.LogWarning("Completion filtered: hate={Hate} violence={Violence}",
filter?.Hate?.Filtered, filter?.Violence?.Filtered);
return Results.Problem("Response blocked by content policy.");
}
return Results.Ok(resp.Value.Content[0].Text);
}
catch (ClientResultException ex) when (ex.Status == 400 && ex.Message.Contains("content_filter"))
{
logger.LogWarning("Prompt filtered: {Message}", ex.Message); // blocked prompt: HTTP 400
return Results.Problem("Request blocked by content policy.");
}How Azure OpenAI Integrations Fail
1. Calling the model name instead of the deployment name. The OpenAI SaaS uses the model name. Azure OpenAI uses the deployment name you assigned in step 1. Mixing them yields 404 with a confusing "model not found" error.
2. Leaving keys enabled. If disableLocalAuth: true is not set, anyone with the key bypasses Entra and your Conditional Access policies. Always disable local auth in production resources.
3. Treating quota as capacity. Quota (TPM) is a soft cap your subscription is allowed to consume. Capacity is what the region can actually serve right now. You can have quota and still get 429s during a regional spike. PTUs reserve capacity, though they also return 429s once you exceed what you bought.
4. One resource per workload in one region. If eastus2 capacity dries up, your app dies. Provision the same deployment name in 2-3 paired regions and put Azure API Management or your own retry logic in front to fail over.
5. Pinning the model version to latest. Azure OpenAI models have explicit dated versions (gpt-5.6-sol:2026-07-09). Using auto-update means a model upgrade can change behavior under your tests. Pin the version, schedule the upgrade.
6. Ignoring the deprecated OpenAIClient. The old Azure.AI.OpenAI v1 client is replaced byAzureOpenAIClient (which delegates to the official OpenAI types). New code should use AzureOpenAIClient + theOpenAI.Chat namespace.
Planning Around Capacity
On Azure, capacity is something you design for. Standard deployments use shared capacity with tokens-per-minute quotas, and Provisioned Throughput Units give you reserved capacity for predictable latency at a committed cost. A sensible pattern for production is to run PTU for your baseline, then spill over to a standard or global deployment at peaks, with a gateway such as API Management handling the routing. Run the sums first, since PTU only pays off at steady, high usage.
Global and Data Zone deployments can get you far more quota and new models sooner, but your data may be processed outside a single region. Check this against your data-residency commitments before you enable them, because it's a compliance decision rather than a technical one.
Lifecycle and retirements
Model versions on Azure have published retirement dates, and they come around quickly. As of October 2026, the newest OpenAI family on Azure is GPT-5.6, and older GPT-4o and o-series deployments retire between November 2026 and April 2027. Keep a list of your deployments with their dates, and test the replacement well before you must switch. Auto-upgrade settings can change model behaviour under you, so decide deliberately whether to use them, and run your evals when a change lands.
Azure also serves non-OpenAI models through Microsoft Foundry, which lets you compare models behind one platform. Remember that features vary by model and region, so a capability in the docs may not exist in your deployment.
Authentication and monitoring
Use Microsoft Entra ID with a managed identity rather than API keys, and disable key access where you can. Route calls through a private endpoint if your data requires it. Then log token usage by caller, because the portal's totals can't tell you which team or feature is spending the quota. Handle 429s with backoff using the Retry-After header, since hitting quota is normal behaviour here, and your app should expect it.
What I Would Do Before Launch
- Provision with Bicep, keys disabled, system-assigned identity, private endpoints. No exceptions for "dev".
- Deploy each model with a name you control (e.g.,
chat-prod,chat-canary) — your code calls the name. - Auth via
DefaultAzureCredential(.NET) orget_bearer_token_provider(Python). Never store a key. - Pick PTUs the moment you have an SLA. Standard for batch, dev/test, and burst.
- Always inspect
finish_reason; log content-filter trips with the categories that fired. - Pin model versions explicitly. Upgrade through deployments, not through silent updates.
- Provision in 2-3 regions and put a gateway in front for cross-region failover when quota tightens.