LiteLLM with Azure OpenAI and Azure AI Foundry

Connecting LiteLLM to Azure OpenAI deployments and Azure AI Foundry models requires a deliberate choice of auth method, routes and cost mapping. This page sets out the decisions, sequence and failure points.

On this page

How LiteLLM connects to Azure OpenAI and Azure AI Foundry

A platform team that routes Azure-hosted models through a shared gateway needs one place where every Azure deployment is declared, authenticated and metered. LiteLLM provides that place. Its Azure route takes AZURE_API_KEY, AZURE_API_BASE and AZURE_API_VERSION, or an AZURE_AD_TOKEN in place of the key, and it covers chat completions, responses, completions, embeddings, audio, fine-tuning, batches, files and images. Callers keep sending requests in the OpenAI format, and the gateway translates them to the Azure endpoint. That means the gateway, not each application, holds the Azure credentials, which is the main reason to put Azure behind it.

Before building anything, decide which authentication method the gateway will use. An API key is the simpler setup, but it is a long-lived shared secret that must be rotated and stored in your secret manager. An Entra ID token through AZURE_AD_TOKEN ties access to a workload identity and fits better with the access reviews your security team already runs, though the token source and refresh process must be planned and tested. Confirm with your Azure administrators which resource, region and deployment names each team will use, since the gateway's model entries must match them exactly. Also confirm which Azure API version your deployments support, because AZURE_API_VERSION determines what the gateway sends.

LiteLLM distinguishes two provider prefixes. The azure/ route targets Azure OpenAI deployments and is the route the supplied documentation describes for the endpoint list above. The azure_ai/ route is for models served through Azure AI Foundry. Choose the prefix per model entry based on where the deployment lives, and check the current LiteLLM Azure OpenAI documentation for the exact parameters each route accepts before you write the configuration, because support for individual endpoints can differ between routes.

What you need before configuring Azure in LiteLLM

Before any Azure route is added to the gateway, a handful of platform pieces and Azure decisions need to be in place. The cards below cover the LiteLLM side (database, cache, secrets and network path) and the Azure side (resource or project, deployment names, API version and identity), which together determine how the configuration behaves once callers start sending traffic.

Self-hosted proxy and PostgreSQL

The LiteLLM proxy runs in your infrastructure, and virtual keys need a PostgreSQL database before any per-key, per-user or per-team budget or model restriction can be enforced. Decide where the database runs, who owns its backups and how it is sized before the Azure routes are wired in. Confirm the proxy image and database version with your own build and test process rather than assuming a default.

Virtual keys docs

Redis once more than one instance runs

A single proxy instance can run without a cache layer, but once you scale to more than one instance, Redis 7.0 or newer holds shared rate limits, router state and cache. Azure deployments that share a rate limit across regions depend on this state being consistent between proxy pods, so plan Redis availability alongside the proxy rather than as an afterthought.

Azure OpenAI resource or Foundry project

Decide which Azure surface each route will call: an Azure OpenAI resource for the azure/ route, or a Foundry project and endpoint for the azure_ai/ route. Each deployment in that resource or project has its own deployment name, which is what LiteLLM calls, not the underlying model name. Record the resource names, regions and deployment names in your configuration inventory before writing the model list.

API version selection

The api_version value sets which Azure API surface LiteLLM requests, and it can change which features and response shapes are available. Pick a version that supports the endpoints you need, such as chat completions or responses, and pin it in configuration. Confirm current Azure API versions and their retirement dates with Microsoft before you standardize on one, because versions move on Microsoft's schedule.

Identity and role assignments

Choose between an API key stored as AZURE_API_KEY and an Entra ID token passed as AZURE_AD_TOKEN, and confirm which managed identity or service principal the gateway will use. The identity needs the Azure role assignments that allow inference on the target resource. Confirm the current built-in role names and assignment scope with Microsoft and your own tenant administrators before granting access.

Network path and master key storage

Confirm that the gateway subnet can reach the Azure endpoint over the route your security team approves, including any private endpoint, firewall or egress proxy. Store LITELLM_MASTER_KEY, which must start with sk-, in a secret manager rather than a plain configuration file, and limit who can read it. Test both settings from the gateway host before adding any model entries.

Configuration sequence for Azure OpenAI routes

This sequence takes an Azure OpenAI or Azure AI Foundry deployment from the Azure portal to a working LiteLLM route, with authentication, regional load balancing, cost tracking and a virtual key limited to the model. Each step ends with a check you can run before moving on.

  1. Create the Azure deployment and record its endpoint

    In the Azure portal, the platform team creates an Azure OpenAI resource or Azure AI Foundry project in the region the organization has approved, then deploys the model under a deployment name. Record the endpoint URL, the deployment name and the API version the deployment accepts. Confirm the model and API version against Azure's current documentation, since availability varies by region. The step is done when a direct request to the deployment from an administrative workstation returns a completion, which proves the deployment works before LiteLLM is involved.

  2. Choose API key or Entra ID token authentication

    The security and platform leads choose how LiteLLM authenticates to Azure. An API key is the simpler option, stored as AZURE_API_KEY. An Entra ID token, supplied as AZURE_AD_TOKEN, avoids a static key but requires a process that obtains and refreshes the token. Store whichever credential you choose in your secret manager and inject it into the proxy environment, never into the config file. The step is done when the chosen credential is present in the proxy's runtime environment and the team has documented who rotates it and how often.

  3. Set AZURE_API_BASE and AZURE_API_VERSION

    Set AZURE_API_BASE to the resource endpoint and AZURE_API_VERSION to the API version the deployment supports, both as environment variables supplied to the proxy. Keep these values in the same configuration source as the credential so that a change to the Azure resource is a reviewed change. The check is a configuration review: the endpoint should match the resource recorded in step one, and the version should match the version tested directly. Mismatched versions are a common cause of errors that look like authentication failures.

  4. Define model_list entries with azure/ or azure_ai/ prefixes

    In the proxy configuration, add a model_list entry for each deployment. Use the azure/ prefix for Azure OpenAI deployments and the azure_ai/ prefix for models served through Azure AI Foundry, and set the deployment name in the model parameter so the route points to the right deployment. Give each entry a stable model_name that callers will use. Confirm the exact route prefix for each model type in LiteLLM's Azure documentation. The check is a test call to the model_name through the proxy with a master key, which should return a completion and create a request log entry.

  5. Add regional deployments under one model name

    If the organization runs the same model in more than one region, add each regional deployment as a separate entry that shares the same model_name. The router then distributes requests across them using the routing strategy you configure, and it can retry or cool down a failing deployment. Choose the routing strategy and retry settings deliberately, and confirm that the data residency rules for every region are approved before adding it. The check is repeated test calls under the shared name, confirming that responses come from more than one deployment in the logs.

  6. Set base_model for accurate cost tracking

    Azure deployment names are chosen by the customer and often do not match the model name that LiteLLM uses to price tokens. Set base_model in the model_info block of each entry to the underlying model so LiteLLM applies the correct price table. Ask the finance or FinOps owner to confirm the rates used match the organization's Azure contract, because list prices and negotiated rates can differ. The check is a test call followed by a spend log entry that shows the expected model and a non-zero cost, which you compare against the Azure billing line for the same request.

  7. Create a virtual key restricted to the model

    A platform administrator creates a virtual key in the LiteLLM admin UI or through the key management API, and limits it to the Azure model_name only. Set a budget and rate limits suited to the team that owns the key. Virtual keys require a PostgreSQL database, which must already be configured. The check is two tests with the new key: a call to the permitted model should succeed, and a call to a model outside the key's list should be refused. Then confirm the spend appears against the key in the logs.

API key or Entra ID token: choosing the authentication method

LiteLLM can reach an Azure OpenAI or Azure AI Foundry deployment with a key-based credential, set through AZURE_API_KEY, or with a bearer token issued by Microsoft Entra ID, set through AZURE_AD_TOKEN. The key is a long-lived secret issued by the Azure resource and sent on every request. The token is short-lived and tied to an identity, so it must be obtained and renewed by something outside the request path. Either way, LiteLLM still needs AZURE_API_BASE and AZURE_API_VERSION to build the correct endpoint, so the authentication choice only changes the credential, not the route.

  • Key-based access: a single secret scoped to the Azure resource, with no per-user identity attached to calls made through the gateway.
  • Token-based access: a credential that represents an Entra ID principal, which must be refreshed before it expires.
  • Shared requirements: the same API base and API version settings apply to both methods.
  • Where the secret lives: in both cases, the value should be read from a secret manager at startup rather than written into configuration files.
  • Confirm first: which Entra ID flow and token lifetime your environment will use before you commit to the token route.

Confirm with your Azure administrator which method your resource accepts for the deployment types you plan to expose through LiteLLM.

How a request travels from a caller to an Azure deployment

A caller sends a request with a LiteLLM virtual key to the proxy inside the client's network. The proxy checks the key and its budget against PostgreSQL, then the router picks one of several regional Azure deployments behind the same model name. The request crosses the trust boundary to the Azure endpoint, and the response returns with spend recorded against the base_model so cost matches the Azure price. Check the trust boundary, the key scope and the spend record first when a call fails or costs look wrong.

Request path from caller through LiteLLM to Azure, with the trust boundary marked.

Mapping Azure deployments, model names and cost fields

This table maps each Azure setting to the LiteLLM field it controls, from the deployment name your callers use to the base_model that sets the price basis for spend records. Read each row alongside your Azure resource settings, because a mismatch in any one field usually shows up as a failed call or as spend recorded against the wrong price.

SettingWhat it controls in LiteLLMWhat to confirm before go-live
Deployment nameThe model_name callers send and the Azure deployment it resolves to; the two can differExact deployment name in each Azure OpenAI or Foundry resource, copied from the Azure portal
api_baseThe regional Azure endpoint each deployment is called through, set per entry in the router listResource endpoint for each region; keep the region in the entry so load balancing and failover stay explicit
api_versionThe Azure API version sent with each request, which can differ by route and featureThe version each route needs for the features you use, such as Responses or batches, checked against current Azure documentation
AZURE_API_KEYKey-based authentication to the Azure resource, suited to a single service identity held in a secret managerKey rotation procedure and where the key is stored; restrict callers to virtual keys, not the Azure key
AZURE_AD_TOKENEntra ID token authentication, for teams that want Azure role assignments and no static keyToken source and refresh path, and that the identity holds the Azure role your deployments require
azure/ routeChat, Responses, completions, embeddings, audio, fine-tuning, batches, files and images on Azure OpenAI deploymentsWhich endpoint types your specific deployment supports in your region before you add it to routing
azure_ai/ routeModels hosted in Azure AI Foundry, which may expose different request shapes from Azure OpenAI deploymentsModel name, endpoint and supported operations for each Foundry model, since support varies by model
base_modelThe price basis used when LiteLLM calculates spend for a deployment, which matters when the deployment name is a custom labelThe base model name that matches your Azure price sheet, so spend records match the bill

Securing the Azure credentials and gateway path

The Azure route gives every caller access to paid, data-bearing model deployments, so the credentials, the model list and the network path need the same care as the gateway itself. The cards below cover where secrets live, who can change routing, which keys can reach which deployments, and where the gateway is allowed to send traffic.

Keep Azure secrets in a secret manager

Store AZURE_API_KEY or the Entra ID client secret used for AZURE_AD_TOKEN flows in a secret manager, not in config.yaml or environment files committed to source control. Confirm with your team which secret stores the gateway can read at startup and who can rotate the Azure credential. Secret manager integrations are listed as an Enterprise feature, so confirm the current scope in the enterprise docs before you plan around it.

Enterprise docs

Protect the LiteLLM master key

LITELLM_MASTER_KEY grants administrative access to the proxy, including key creation and budget changes, so it should be injected at runtime from a secret store. The LiteLLM production guide says this key must start with sk-. Keep it out of config.yaml, out of logs and out of container images, and plan a rotation procedure that does not depend on whoever first deployed the gateway.

Production guide

Scope virtual keys to Azure models

Restrict each virtual key to the specific Azure deployments it needs, so a key issued for a summarization service cannot call an expensive reasoning deployment. Virtual keys also carry budgets and rate limits, which limit damage if a key leaks. Check that every Azure model_name in use is listed in the key's allowed models and that no key is left with access to all models by default.

Virtual keys docs

Limit who can edit model_list

The model_list decides which Azure endpoint, api_version and deployment name a request reaches, and a small change there can redirect traffic or bypass a regional choice. Restrict edits to a named platform group, route changes through version control with review, and log who deployed each change. Confirm how your deployment process applies config changes and whether a reload can happen without a restart.

Allow egress to Azure endpoints only

Configure network policy so the gateway can reach only the Azure OpenAI and Azure AI Foundry endpoints it uses, plus the Redis and PostgreSQL services it depends on. Outbound rules should name your resource endpoints rather than broad internet access. Test the policy from the gateway pod or host, and confirm with Azure documentation which private endpoint or firewall options apply to your resource type.

Review Azure access for the gateway identity

If the gateway authenticates with Entra ID, the identity behind it should hold only the Azure role that the deployments require, such as inference access on the target resources. A broad subscription-level role turns a gateway compromise into access to every resource in that scope. Ask your Azure administrator to document the role assignment and review it on the same schedule as other service identities.

Using regional Azure deployments for load balancing and failover

Multiple Azure deployments can sit behind one model name in the LiteLLM router, so a caller asks for a single alias and the router picks a deployment. Each entry in model_list shares the same model_name but points at a different Azure OpenAI or Azure AI Foundry deployment, with its own api_base and key. The router then chooses among them using routing_strategy. Simple-shuffle is the recommended default. Usage-based, latency-based, least-busy and cost-based strategies are also available, so confirm which one matches how your traffic and budgets behave before you set it. Retries, cooldowns after repeated failures and priority ordering for failover are configured on the same router, so a deployment that starts returning errors is taken out of rotation and traffic moves to the next one in priority order.

Spreading traffic across regions is a governance decision before it is a routing decision. A request that is served from a second region may be processed outside the region your data policy names, so the data residency review must cover every deployment in the pool, not only the primary one. Quota is the second constraint: Azure quota is set per deployment, per region and per model, and a failover target only helps if it has enough tokens per minute to absorb the moved load. Plan quota for the failure case, not only the normal case. Also confirm that the model version and deployment type you need are available in each region, because regional availability differs by model and changes over time.

Before relying on the pool, check regional availability, quota and deployment names with Azure in your own subscription, and confirm the exact model versions offered in each region. Then test the failover path on purpose by disabling one deployment in a non-production environment and watching where requests land, how long cooldowns last and whether callers see errors. Record the regions in your data flow documentation so the residency review and the router configuration stay in step.

Why Azure calls fail through LiteLLM and how to fix them

This table lists the failures teams most often hit when routing Azure OpenAI and Azure AI Foundry calls through a self-hosted LiteLLM gateway, with the likely cause and the fix for each. Read it as a triage list: match the symptom your callers see, then check the configuration item named in the cause column before changing anything else.

FailureLikely causeFix
Requests return a not-found or invalid-version errorThe api_version value does not match the route or the Azure API version the deployment supportsSet AZURE_API_VERSION (or api_version on the model entry) to a version confirmed for that endpoint and route, and test each route separately
Requests return not found for a model that exists in the portalThe deployment name in LiteLLM does not match the deployment name in Azure, which is case-sensitive and separate from the model nameCopy the deployment name exactly from the Azure resource and use it in the model entry, not the underlying model name
Calls fail with a path error or connection errorAZURE_API_BASE includes a path such as /openai or a deployment segment, so LiteLLM builds a malformed URLSet AZURE_API_BASE to the resource endpoint only, then confirm the full URL against the route documentation
Calls work for a while, then return authentication errorsAn Entra ID token passed as AZURE_AD_TOKEN has expired and nothing refreshes itUse a credential flow that refreshes tokens automatically, or confirm how your token refresh job replaces the value before expiry
Spend reports show costs that do not match the Azure invoiceThe model entry lacks base_model, so LiteLLM cannot map the deployment to the correct price table entryAdd base_model to each Azure deployment entry that names the underlying model, then compare a test call's cost with the Azure usage record
Traffic shifts away from one region and latency rises without an obvious errorA regional deployment is failing, the router places it in cooldown after repeated errors, and the remaining deployments absorb the loadCheck router cooldown events and per-deployment error logs, fix or remove the bad deployment, and alert on cooldowns so the problem is not hidden
Calls to a model return permission denied on a key that worked beforeThe virtual key is restricted to a list of models that does not include the new or renamed Azure model entryAdd the model name to the key's allowed models, and confirm the name matches the model_name used in the router configuration

Questions buyers ask before outsourcing the Azure connection

How much effort does an Azure OpenAI connection take to set up?

Effort depends mainly on how many deployments you connect, which authentication model you choose, how many regions are involved and how carefully cost mapping is handled. A single deployment with an API key is a small task. Many deployments across several regions, with Entra ID tokens, per-team keys and accurate base_model cost mapping, is a larger one. Each deployment needs its own route entry, api_version and credentials, and each one needs a test that confirms requests, streaming and spend are recorded correctly. Ask any partner to break the estimate down by deployment count, auth model, region count and cost mapping, and to state what is excluded.

Can our own engineers connect LiteLLM to Azure without a partner?

Yes, a capable platform team can connect a single Azure OpenAI deployment using the documented settings for AZURE_API_KEY, AZURE_API_BASE and AZURE_API_VERSION. The harder parts tend to be the ones that repeat: Entra ID token flow, regional deployments for load balancing, cost accuracy for deployment names that differ from model names, and verifying the Azure AI Foundry azure_ai/ route against the models you actually use. Teams that lack Azure identity experience or a test plan often find the rework costs more than the initial build. Decide based on who will own the configuration after go-live.

What do our Azure and identity administrators need to provide?

The work needs a small set of Azure and identity decisions and access. Azure administrators typically need to confirm which Azure OpenAI resources and Foundry projects are approved, in which regions, and which deployment names map to which models. For Entra ID token auth, identity administrators need to create or approve a service principal or managed identity, grant it the right role on the resource, and agree how tokens are rotated and stored. Security teams should confirm where keys live, which secret manager holds them and who can read them. Agree these items in writing before the build starts so the engagement does not wait on access.

How long does an Azure integration take?

Duration follows scope. A single-region connection with one auth model and a short test plan is shorter than a multi-region rollout with Entra ID, per-team access and cost reporting checked against provider bills. Timing also depends on how quickly your administrators approve resources and identities, because those approvals often set the pace. DeployOpen does not publish a fixed timeline for this work. Scope, deliverables and timeline are agreed in writing before work starts, so ask for a dated plan that lists the dependencies on your side.

What costs recur after the Azure connection goes live?

Several costs recur after go-live. The largest is the Azure consumption you pay to Microsoft for tokens and requests, which LiteLLM records but does not reduce. Your own infrastructure also recurs, including the PostgreSQL database, Redis once more than one proxy instance runs, compute for the proxy and storage for logs. Routes and API versions change over time as Azure and LiteLLM release updates, so someone must review them. Pricing data for new models needs refreshing so spend stays accurate. If you engage a partner for support or retainers, that is a separate recurring commitment defined in its own written agreement.

What drives the cost of setting up the connection?

Cost is driven by the work involved, not by a single product price. The main drivers are the number of deployments and models, whether Entra ID token auth needs new identity configuration, how many regions and load balancing groups are built, how precisely base_model is set so spend matches provider bills, and how much testing you require before go-live. The fee for an implementation is set in a written quote that follows the agreed scope. Ask for line items for design, configuration, testing and handover, and state which of these you will perform yourself.

What should we verify before accepting the Azure work?

Ask for evidence against your own deployments rather than a general statement that the connection works. Useful checks include a request to each deployment through the proxy with the expected route, a streaming test, a confirmation that the chosen api_version supports the endpoints you use, a test of Entra ID token refresh, a check that a restricted virtual key can reach only its approved models, and a spend record that matches the Azure usage for a sample of requests. Ask for these results in a written handover so your team can repeat them after changes.

What do we need to confirm about Azure AI Foundry models?

Confirm which Foundry models you plan to use, whether each one is reached through the azure_ai/ route, and which endpoints it supports. Route support differs between Azure OpenAI and Foundry models, so do not assume a model behaves the same way on both. Check the LiteLLM Azure documentation for the endpoints each route supports, and check Azure for the model availability in your chosen region. Ask the implementation partner to list the models in scope and the verification they will run for each one before go-live.

What to confirm with Azure and LiteLLM before you build

Before you write any Azure configuration, verify four things instead of assuming them: the Azure API versions each route accepts, whether each Foundry model you need is reachable through the azure_ai/ route, how Entra ID tokens are refreshed in the LiteLLM release you plan to run, and which release line you will pin. Azure retires and changes API versions on its own schedule, so the AZURE_API_VERSION value (or the api_version set per deployment) should be checked against the current Azure OpenAI documentation for each route you use, including /chat/completions, /responses, /embeddings and any batch or file routes. Ask your Azure team which API version your resource and deployment type support, and record it in your configuration as code so a change is a reviewed diff, not a surprise at runtime.

Second, confirm model reachability per route. The Azure OpenAI route and the Foundry route are not interchangeable, and a model that appears in the Azure AI Foundry catalog may not be callable through azure_ai/ in the LiteLLM version you run. Test each model with a real request in a non-production environment, and confirm the exact route prefix, base URL and deployment name for it. For token auth, check how the release you pin handles AZURE_AD_TOKEN or the Entra ID credential flow: whether tokens are fetched and refreshed automatically, how long a token is cached, and what error appears when refresh fails. Test this with a token that is allowed to expire during a long-running load test, not only with a fresh token.

Third, pin a release line. LiteLLM maintains support for the four most recent stable minor versions for both open source and Enterprise deployments, and the GitHub releases page is where you confirm the current list. Choose one line, confirm it contains the Azure fixes you depend on, and check the LiteLLM Azure OpenAI docs for the route and parameter behavior of that version before you build. Record the chosen version, the Azure API version and the model list together, because each one changes independently and an upgrade should re-run the same verification.

How DeployOpen scopes and delivers the Azure integration

DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside the client's own infrastructure. For LiteLLM with Azure OpenAI and Azure AI Foundry, we start from the Azure resources, identity model and cost reporting your teams already use, then write the gateway configuration around them.

How we scope

  • We confirm which Azure OpenAI and Foundry deployments, regions and model families the gateway must route to.
  • We agree whether Azure callers authenticate with API keys or Entra ID tokens, and who owns each credential.
  • We record the written scope, deliverables and timeline with you before any build work starts.

How we build

  • We configure azure/ and azure_ai/ routes, api_version values and base_model mappings for each deployment in scope.
  • We set up regional deployments, router settings and fallbacks, then test routing and cooldown behavior under failure.
  • We wire virtual keys, budgets and logging so Azure spend can be matched against your Azure billing exports.

How we hand over

  • We deliver the configuration as versioned files, with a runbook for adding deployments, rotating keys and changing regions.
  • We document the verification steps, including test calls per route and a cost reconciliation check against a sample billing period.
  • We walk your platform and security teams through the design so they can review and operate it without us.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainers can cover LiteLLM version upgrades, new Azure deployments and changes to Entra ID or key policy.
  • Ask any partner to confirm response times and what a retainer includes in writing before you sign.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.