Skip to main content
Back

Akumina AI Configuration for Azure AI Gateway

Azure AI Gateway
Configuring the AI Gateway tier for Microsoft Foundry and third-party models
A step-by-step configuration and troubleshooting guide
Publishing models through the AI Gateway portal at ai.gateway.azure.com
Public preview — East US 2 and Sweden Central

Overview

This guide explains how to publish AI models through the Azure AI Gateway tier so that applications call a single governed endpoint instead of calling each model provider directly. The gateway holds every provider credential, applies policy before the request reaches a backend, and emits token and latency telemetry for each call.

The AI Gateway tier is a separate product surface from the AI-gateway capabilities built into a classic Azure API Management instance. It is administered from its own portal at ai.gateway.azure.com, not from the Azure portal; it has no XML policy documents, no API URL suffix, and no operations to define. Models are registered as assets and are routed to by name. If you are configuring Microsoft Foundry behind a classic APIM instance instead, that is a different procedure and a different endpoint shape.

This document covers models only. The same gateway can also federate MCP tool servers; those are outside the scope of this guide.

Key concepts

Term Meaning
Gateway The resource you create in the portal. Its name forms the runtime hostname, so it cannot be changed afterwards.
Model provider A logical backend grouping — one Foundry account, or one third-party vendor — that holds the endpoint address and the credential used to reach it.
Model A single published model inside a provider. Callers select it by putting its name in the request body’s model field. Names must be unique across the whole gateway.
Runtime access key The key an application sends to the gateway. Created on the Keys page and passed in the api-key header.
Policy A governance rule (content safety, IP filter, token rate limit, request rate limit) configured as a portal card and evaluated before the backend is called.
Preview status. The AI Gateway tier is in public preview. There is no SLA, and portal workflows, quotas, regions, telemetry, and pricing can change. Preview quotas cap the number of models, tools, and runtime access keys as well as request and token throughput. Pilot it with non-critical workloads first.

Prerequisites

   An Azure subscription in which you have permission to create resources, and a Microsoft Entra ID account to sign in with.
   Reader access on every subscription you want the gateway to scan for Foundry accounts.
   A Microsoft Foundry or Azure OpenAI resource with at least one model deployment, and/or credentials for the third-party provider you intend to publish.
   For key-based backend authentication to Foundry: local (key) authentication enabled on the account and permission to list its keys, for example Cognitive Services Contributor.
   For managed-identity backend authentication to Foundry: write access on the gateway plus User Access Administrator or Owner on each Foundry account, so the Foundry User role can be assigned.
   A region in which the preview is available — East US 2 or Sweden Central at the time of writing. Availability can vary by subscription, cloud, capacity, and preview enrolment, so confirm the list in the portal before planning a rollout.

Signing in to the AI Gateway portal

The AI Gateway tier has a standalone web portal. It is not a blade inside the Azure portal, and browsing to portal.azure.com will not find it.

1.   Browse to https://ai.gateway.azure.com.
2.   Select Sign in and authenticate with Microsoft Entra ID. Use the account that holds the subscription permissions listed under Prerequisites — administration is Entra-based, and runtime access keys play no part in signing in.
3.   If your tenant enforces conditional access or you hold the required roles through a Privileged Identity Management assignment, activate that assignment before signing in. Resource discovery reflects the permissions of the signed-in session.
4.   Once signed in, select your gateway from the portal home page. Most import actions fail with a Select a gateway prompt until a gateway is selected.

Creating the gateway and naming it to your standard

There are three different names in play, and only two of them can be changed later. Deciding all three before you create anything is the single most useful piece of preparation for this product.

The gateway name — permanent, and part of the URL

On first use, select Create gateway and complete the form:

1.   Name — becomes part of the runtime endpoint hostname.
2.   Subscription — the subscription that will be billed.
3.   Region — choose a supported preview region (East US 2 or Sweden Central).
4.   Advanced — optionally set the resource group. One is created automatically if you do not.
5.   Select Create. Provisioning normally completes in under a minute; there are no scale units to size.

The name you type becomes the hostname, and the runtime endpoint takes this shape:

https://<gateway>.azure-api.net/default/models/openai/v1

Because that hostname is public DNS, the name must be globally unique and is restricted to characters that are legal in a hostname — lowercase letters, digits, and hyphens. The portal validates the value as you type it.

It cannot be renamed after creation. Renaming would move every client’s endpoint. If you need a different name, create a second gateway and migrate.

Applying your naming standard. Encode owner, workload, environment, and region in the name, and keep it short enough to stay readable in a URL. A convention that works well:

<org>-aigw-<workload>-<env>-<region>
 
akm-aigw-core-dev-eus2
akm-aigw-core-prd-eus2

Avoid embedding a model or vendor name in the gateway name. One gateway is expected to front many providers, so a name like akm-aigw-openai-prd ages badly the moment a second vendor is added.

Provider and model names — set at import, and what callers actually use

The gateway routes on an exact match of the model value in the request body, so model names are a public contract with every client application. Two rules follow:

   Every model name must be unique across the entire gateway, not merely within its provider. Two providers that both publish a deployment called gpt-4o cannot both be imported as-is.
   Renaming a model or provider after import is not exposed in the preview portal. You can update a model’s authentication and its policies, or remove it — but not change its name. Set names correctly at import time, or plan to delete and re-add the asset.

When you import from Foundry, the deployment name in Foundry becomes the model name in the gateway. If your standard requires names such as akm-gpt-4o-chat, rename the deployments in Foundry before you import, rather than trying to correct them afterwards. Deployment names that collide with a model already in the gateway are skipped during import and reported as warnings — the import as a whole still succeeds, which makes the warnings easy to miss.

The provider display name is presentation only and is safe to set to whatever reads best for your teams; the provider name is the identifier. Neither appears in the request body.

Importing Microsoft Foundry models

Foundry models are imported by discovery: the gateway scans the subscriptions you nominate, finds Foundry and Azure OpenAI accounts, and registers their deployments. You do not enter endpoints or keys by hand.

Running the import

1.   From the portal home page, go to Get startedConfigure to open the setup wizard (route /settings/start), then select Import Foundry models. The same action is available later from the models page as Import from Foundry.
2.   Select the subscriptions to scan, and optionally narrow the scan to a resource group.
3.   Review the discovered accounts. Deployments are grouped under their parent Foundry account and selection is per account — selecting an account imports every deployment it holds. Retire unused deployments in Foundry first if you do not want them published.
4.   Choose the backend authentication method — see Backend authentication below.
5.   Select Import. A verification check runs first, confirming that the chosen authentication actually works and looking for model-name conflicts. Read the inline warnings before moving on.

The import creates one model provider per Foundry account and registers each of that account’s deployments as a model. The models are callable immediately — there is no publish or deploy step.

Backend authentication: key-based or managed identity

Method How it works When to use it
Key-based The gateway reads the Foundry account key and stores it, then sends it to the backend in the api-key header. This is the default. Quick pilots, or accounts where Entra-only authentication is not yet possible. Requires local authentication to be enabled on the account.
Managed identity The gateway authenticates to Foundry with its own system-assigned or user-assigned identity. The wizard can enable the system-assigned identity and assign the Foundry User role for you. Recommended for production. No provider secret is ever stored, and access is revoked by removing a role assignment.

The Foundry User role ID is 53ca6127-db72-4b80-b1b0-d745d6d5456d. If you prefer to assign it yourself rather than let the wizard do it:

RG="/subscriptions/<sub-id>/resourceGroups/<rg>"
ACC="$RG/providers/Microsoft.CognitiveServices/accounts/<foundry-account>"
 
az role assignment create \
  --assignee-object-id "<gateway-principal-id>" \
  --assignee-principal-type ServicePrincipal \
  --role "53ca6127-db72-4b80-b1b0-d745d6d5456d" \
  --scope "$ACC"
If your tenant reports that role ID as unknown, confirm it with az role definition list --name "Foundry User" and substitute the value it returns. Role assignments also take a few minutes to propagate — an import or a call that fails with 403 immediately after the assignment is usually just early, so retry before investigating.

Supported models and API types

Each model is registered against one or more supported endpoints. The endpoint type determines the request and response schema the caller must use and the path the caller posts to. All paths hang off the gateway’s models base:

API type Request path Typical use
OpenAI Chat Completions .../models/openai/v1/chat/completions The default for Foundry, Azure OpenAI, OpenAI, and any OpenAI-compatible vendor.
OpenAI Responses .../models/openai/v1/responses The newer OpenAI stateful surface, for reasoning models and tool-using agents.
Anthropic Messages .../models/anthropic/v1/messages Claude models called in Anthropic’s native Messages schema, passed through.
Other Provider-specific passthrough Vendors whose schema is neither OpenAI nor Anthropic. The gateway governs and forwards without translating.

Providers that can be published this way include Microsoft Foundry, Azure OpenAI, OpenAI, Anthropic, AWS Bedrock, Google Vertex and Gemini, and self-hosted or custom OpenAI-compatible endpoints.

Routing is by model name, not by path. Within an API type, the gateway inspects the model field of the request body and forwards to whichever provider owns that name. A caller never names the provider, and switching a model from one vendor to another needs no client change — only that the name stays the same.
{
  "model": "akm-gpt-4o-chat",
  "messages": [
    { "role": "user", "content": "Summarize the incident report." }
  ]
}

Configuring other vendor models

Any provider that is not discovered automatically is added through Add a custom model. The flow is identical for every vendor; only the field values differ.

The common flow

1.   Select Add a custom model.
2.   Enter the provider display name, the provider name, and an optional description.
3.   Enter the base endpoint URL, the authentication header name the vendor expects, and the API key. The key is encrypted at rest and is never returned to callers.
4.   Define each model name callers will use, and tick its supported endpoints — OpenAI chat completions, OpenAI responses, Anthropic messages, or Other.
5.   Select Create. Connectivity is verified as the provider is created; there is no separate test step.
The connection stores one static header — a header name and a fixed value. A vendor whose authentication requires a computed per-request signature, or a token that expires, does not fit this model directly; see Google Vertex AI and AWS Bedrock below.

OpenAI

Field Value
Base endpoint URL https://api.openai.com/v1
Authentication header name Authorization
API key Bearer sk-...
Supported endpoints OpenAI chat completions, OpenAI responses

Anthropic

Field Value
Base endpoint URL https://api.anthropic.com
Authentication header name x-api-key
API key Your Anthropic API key
Supported endpoints Anthropic messages
Anthropic’s API requires an anthropic-version header on every request. The gateway does not add it, so the calling application must send it — see the curl example under Validating with curl.

Google Gemini

Field Value
Base endpoint URL https://generativelanguage.googleapis.com/v1beta/openai
Authentication header name Authorization
API key Bearer <Google AI Studio key>
Supported endpoints OpenAI chat completions

Google publishes an OpenAI-compatible surface for Gemini, which is why this registers as an OpenAI chat completions model rather than as passthrough. The key comes from Google AI Studio and is a long-lived string, so it fits the static-header model cleanly.

Google Vertex AI

Vertex AI is the enterprise surface for the same models, addressed per region:

https://<region>-aiplatform.googleapis.com
Vertex authenticates with a Google OAuth access token derived from a service account, and those tokens expire after roughly an hour. A static Authorization header will therefore start returning 401 shortly after it is configured. Unless you have a process that rotates the stored value on a schedule, prefer the Gemini OpenAI-compatible endpoint under Google Gemini for gateway-published models, and keep Vertex for workloads that call Google directly.

AWS Bedrock

Field Value
Base endpoint URL https://bedrock-runtime.<region>.amazonaws.com
Authentication header name Authorization
API key Bearer <Bedrock API key>
Supported endpoints Other (provider-specific passthrough)

Bedrock’s native authentication is AWS Signature Version 4, which signs each request with a hash of its body and a timestamp. That cannot be expressed as a static header. Amazon Bedrock API keys solve this: they are bearer tokens accepted in the Authorization header in place of SigV4. AWS positions long-term keys for exploration only, and short-term keys — valid for up to 12 hours, or the console session duration if that is shorter — as the production choice, so a rotation process is required either way.

If neither option is acceptable, the alternative is to front Bedrock with a component that can perform SigV4 signing — a classic Azure API Management instance with a signing policy, or a small proxy of your own — and register that component’s endpoint as the custom model instead.

Self-hosted and other OpenAI-compatible endpoints

Anything that speaks the OpenAI schema — a self-hosted inference server, a Hugging Face Text Generation Inference endpoint, another vendor’s compatibility layer — is registered the same way: its base URL, its header name, its key, and the OpenAI chat completions endpoint type. If the endpoint is reachable only from a private network, configure outbound virtual network integration on the gateway’s Networking page first, and make sure the backend hostname resolves to its private address.

How it works — the request flow

Every runtime call passes through four stages inside the gateway. Knowing the order is what makes the status codes under Troubleshooting diagnosable, because each stage fails differently.

Stage What happens What it means when it fails
1 Authenticate The gateway validates the runtime access key in the api-key header. A missing or unknown key is rejected here, before any policy or backend is touched.
2 Resolve the model The model value in the request body is matched exactly against the registered models. No match means no backend can be selected.
3 Evaluate policies Content safety, IP filter, token rate limit, and request rate limit all evaluate before the backend is called. If any one blocks, the request stops and the backend is never charged.
4 Forward and record The gateway calls the provider using the stored backend credential — key, OAuth, or managed identity — returns the response, and emits OpenTelemetry logs, latency, and token counts.

Two consequences are worth stating plainly. First, applications never hold a provider credential — they hold a gateway key, and the gateway holds the provider secrets, so rotating an OpenAI or Anthropic key is an administrative change with no client deployment. Second, because policy runs at stage 3, a blocked request costs nothing at the provider and appears in gateway telemetry but not in the provider’s billing.

Policies are configured as portal cards rather than XML documents. Add one under PoliciesAdd policy, choose the policy type, select the models it applies to, and complete the configuration step.

Policy Blocks with Controls
Content safety 400 Azure AI Content Safety checks on prompts and inputs; severity thresholds for hate, sexual, violence, and self-harm; Prompt Shields; blocklists.
IP filter 403 Allow and deny lists of IPv4/IPv6 CIDR ranges, to keep runtime calls inside approved networks.
Token rate limit 429 Prompt plus completion token throughput per caller identity or caller IP, over a minute, hour, or day. Models only.
Request rate limit 429 Call volume per caller identity or caller IP over a 30-second, 1, 2, or 5-minute window.

Token rate limits also return remaining-tokens and consumed-tokens response headers, plus remaining-quota-tokens where the limit period is an hour or longer. Well-behaved clients can use them to self-throttle before they are rejected.

Authentication — the header your client must send

Applications authenticate to the gateway with a runtime access key, passed in the api-key header:

api-key: <runtime-access-key>

Create keys in the portal under KeysCreate API key. In preview a key is gateway-scoped: it reaches every published model and tool, and per-asset scoping is not yet available. Issue one key per application per environment so that a compromised key can be rotated without a coordinated outage.

The header name matters, and it is the most common cause of a rejected call. Three plausible-looking alternatives all fail — see the table below.
Header Result
api-key Correct. This is the header the AI Gateway tier reads.
Ocp-Apim-Subscription-Key Rejected. This is the classic API Management subscription header and has no meaning here.
Authorization: Bearer <key> Rejected. The OpenAI and Anthropic SDKs send their credential this way by default, so an SDK pointed at the gateway without explicit header configuration will fail until it is overridden.
subscription-key Rejected. There is no query-string equivalent for the runtime access key.

The other headers a call may need are the ordinary ones: Content-Type: application/json on every request, anthropic-version on Anthropic Messages calls, and optionally x-correlation-id to tie a gateway log entry back to an application trace. Never put personal data, secrets, or prompt content in the correlation ID.

Do not confuse the runtime access key with the backend credential. The api-key header carries the gateway’s key. The Foundry, OpenAI, or Anthropic key stays inside the gateway’s provider configuration and must never be sent by a client.

Validating with curl

Test the gateway on its own before wiring an application to it. Replace <gateway> with your gateway name and <runtime-access-key> with a key from the Keys page.

Chat completions

curl -X POST "https://<gateway>.azure-api.net/default/models/openai/v1/chat/completions" \
  -H "api-key: <runtime-access-key>" \
  -H "Content-Type: application/json" \
  -d '{"model":"akm-gpt-4o-chat","messages":[{"role":"user","content":"hi"}]}'

Responses

curl -X POST "https://<gateway>.azure-api.net/default/models/openai/v1/responses" \
  -H "api-key: <runtime-access-key>" \
  -H "Content-Type: application/json" \
  -d '{"model":"akm-gpt-4o-chat","input":"hi"}'

Anthropic messages

curl -X POST "https://<gateway>.azure-api.net/default/models/anthropic/v1/messages" \
  -H "api-key: <runtime-access-key>" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model":"akm-claude-sonnet","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'

On Windows cmd.exe

Single quotes are not string delimiters in cmd.exe; using them corrupts the JSON body and produces a 400 or a provider-side error that looks unrelated to quoting. Wrap the body in double quotes and escape the inner ones, or put the body in a file and reference it with -d @body.json.
curl -X POST "https://<gateway>.azure-api.net/default/models/openai/v1/chat/completions" ^
  -H "api-key: <runtime-access-key>" ^
  -H "Content-Type: application/json" ^
  -d "{\"model\":\"akm-gpt-4o-chat\",\"messages\":[{\"role\":\"user\",\"content\":\"hi\"}]}"
Pass: a 200 with a completion confirms four things at once — the key is valid, the model name resolves, no policy blocked the call, and the backend credential works. If it fails, Troubleshooting maps the status code to the stage that produced it.

Troubleshooting

The symptoms below are ordered roughly by how often teams meet them. The status code identifies which stage of How it works rejected the call.

Symptom Root cause Fix
401 on every call The runtime access key is not in the header the gateway reads — commonly sent as Authorization: Bearer by an SDK’s default behaviour, or as Ocp-Apim-Subscription-Key by habit. Send the key in the api-key header. If you are using the OpenAI or Anthropic SDK, override its default auth header explicitly rather than relying on the client constructor’s key argument.
401 only after an import change A Foundry provider was imported with managed identity, but the account does not accept Entra ID authentication — or a stored third-party key has expired, which is the normal end state for a Google Vertex OAuth token. Confirm the backend accepts the chosen method. For Vertex, refresh the stored token or move to the Gemini OpenAI-compatible endpoint.
403 Either an IP filter policy rejected the caller’s address, or the gateway’s managed identity lacks the Foundry User role at the backend scope. Check the IP filter policy’s allow list against the caller’s egress address. Otherwise verify the role assignment and allow several minutes for propagation.
404 or model not found The model value does not exactly match a registered model name, or the request was posted to the path of a different API type. Compare the model string character for character against the models list — matching is exact. Confirm the path matches the model’s registered endpoint type.
400 with a content-safety message The content safety policy blocked the prompt at a configured severity threshold, or a blocklist term matched. Review the thresholds and blocklists on the policy card. Test the same prompt against the provider directly to confirm the gateway is the source of the block.
400 from the provider The payload is valid JSON but contains a parameter the model rejects, or the body was corrupted by shell quoting. Send the same body directly to the provider. On Windows, re-test with -d @body.json to eliminate cmd.exe quoting.
429 with Retry-After A token rate limit or request rate limit was exceeded. Honour Retry-After. Use the remaining-tokens and remaining-quota-tokens response headers to self-throttle, and raise the limit on the policy card if the ceiling is genuinely too low.
Import finds fewer accounts than expected The signed-in account lacks Reader on some subscriptions, so those resources are invisible to discovery. Grant Reader on the missing subscriptions and select Refresh to re-run discovery.
Import succeeds but a deployment is missing Its name collided with a model already registered in the gateway and was skipped with a warning. Rename the deployment in Foundry to a unique value and re-import, or remove the conflicting model first.
Foundry validation fails during import Key-based import was chosen but local authentication is disabled on the account, or managed identity was chosen without the Foundry User role. Enable local authentication, or assign the Foundry User role to the gateway identity.
Every import action refuses to start No gateway is selected in the portal session. Select the gateway on the home page, then retry.
Timeouts to a private backend Outbound virtual network integration is configured but the backend hostname does not resolve to its private address, or a subnet or NSG rule is missing. Check the private DNS zone links, and confirm the delegated subnet (/27 minimum, /24 recommended) allows outbound TCP 443 to the Storage and AzureKeyVault service tags.

Fastest way to isolate a problem

   Read the status code first. 401 and 403 are the gateway; 429 is a policy; 400 is either content safety or the provider; a 5xx is almost always the provider.
   Call the provider directly with the same body. If it fails there too, the gateway is not involved. If it succeeds directly and fails through the gateway, the difference is a policy, the model name, or the stored backend credential.
   Send an x-correlation-id and look the call up in monitoring. With Application Insights connected, the gateway records request volume, latency, errors, and token counts per model.
   Check token usage by model when cost or throttling is the concern. Telemetry follows the OpenTelemetry GenAI conventions, so metrics are grouped by gen_ai.request.model, gen_ai.response.model, gen_ai.operation.name, and gen_ai.token.type.

Security notes

   Treat runtime access keys as secrets. Keep them in a secret store, never in source control, logs, notebooks, tickets, or shared documents, and rotate any key that has been exposed.
   Because preview keys are gateway-scoped, one leaked key reaches every published model. Issue one key per application per environment so that revocation is surgical, and review gateway logs after every rotation.
   Prefer managed identity for backend authentication wherever the provider supports it. It removes a stored secret entirely and makes access revocable through a role assignment.
   Apply content safety and an IP filter as a baseline across all models, then layer token limits onto the expensive ones. Policies evaluate before the backend is called, so they cap spend as well as risk.
   Data residency depends on the whole request path, not just the gateway’s region — account for the locations of the gateway, the model backends, the logging destination, and the calling applications.
Payload logging. It is off by default. Enable it only with a clear understanding of what prompts and completions may contain, and where that data will be stored.
^ Top