Guides Providers
Azure OpenAI Chat Completions
Forward OpenAI Chat Completions requests to an Azure OpenAI deployment through the Azure adapter, authenticating with a resource key or the experimental Entra ID helper.
On this page
Forward OpenAI Chat Completions requests to an Azure OpenAI deployment through the Azure adapter, authenticating with a resource key or the experimental Entra ID helper.
Prerequisites
Complete the shared prerequisites and workflow,
which also has the validate and start commands for provider-local.yaml.
Configure, run, and verify
Build the standard binary and copy the full Azure example:
cargo build -p praxis-ai-proxy
cp examples/configs/azure/chat-completions-to-openai.yaml provider-local.yaml
export AZURE_OPENAI_KEY='<resource-api-key>'
Edit the copy:
- Replace
gpt-4oin thepath_rewritedeployment path with your deployment name (not the model name), and set the Azure adapter’s API version to one that deployment supports. - Replace the load-balancer cluster with the following, using your resource
hostname throughout. Keep
path_rewritebefore the adapter.
- filter: load_balancer
clusters:
- name: azure-backend
endpoints: ["<resource>.openai.azure.com:443"]
tls:
sni: "<resource>.openai.azure.com"
- Between
routerandload_balancer, insert:
- filter: headers
request_remove: [authorization, x-api-key]
request_set:
- name: Host
value: "<resource>.openai.azure.com"
- filter: credential_injection
clusters:
- name: azure-backend
header: api-key
env_var: AZURE_OPENAI_KEY
strip_client_credential: true
Remove the example’s insecure_options for the public endpoint. Validate and
start with the shared commands, then test:
curl --fail-with-body http://127.0.0.1:8080/v1/chat/completions \
-H 'content-type: application/json' \
-d '{"model":"deployment-is-selected-in-config","messages":[{"role":"user","content":"Hello"}]}'
Expect Chat Completions choices and usage. The adapter drops the body model
in favor of the configured deployment path, adds api-version, and normalizes
responses. It also handles SSE: add "stream":true and -N. Azure safety
annotations are discarded. See the
adapter reference
and matrix.
To use an Entra client secret instead of a resource key, build with
--features azure-ad-filter and replace the key injection, after routing, with
the complete Entra settings. Set tenant,
client, scope, and AZURE_CLIENT_SECRET in the proxy shell. The helper is
experimental and does not cover every Azure identity flow.
Cleanup
Stop the proxy with Ctrl+C. In its shell, unset the credentials:
unset AZURE_OPENAI_KEY AZURE_CLIENT_SECRET
Then finish the shared cleanup.