> ## Documentation Index
> Fetch the complete documentation index at: https://backstage.spotify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure OpenAI

> Connect Azure OpenAI to AI Gateway with API keys, resource names, deployment configuration, and optional gateway base URLs.

## Overview

Azure OpenAI Service provides access to OpenAI's models through Microsoft Azure infrastructure. AI Gateway can be configured to use Azure OpenAI for various AI operations with your Azure infrastructure.

## Configuration

To use Azure OpenAI, configure it in the Plugin settings page under the `AI Gateway` section:

| Field             | Description                                                            | Example                                           |
| ----------------- | ---------------------------------------------------------------------- | ------------------------------------------------- |
| **API Key**       | Your Azure API key                                                     | `your-azure-api-key`                              |
| **Resource Name** | Used in URL: `https://{resourceName}.openai.azure.com/openai/v1`       | `your-resource-name`                              |
| **API Version**   | Optional, defaults to preview                                          | `2024-02-15-preview`                              |
| **Base URL**      | Optional, to point at a gateway (overrides resourceName when provided) | `https://ai-gateway.example.com/azure`            |
| **Headers**       | Optional, e.g. for authentication with gateway                         | Key: `X-Custom-Header`<br />Value: `custom-value` |

Then set the default language model (using your Azure deployment name):

```
Language Model: azure|your-deployment-name
```

## Azure Setup

### Prerequisites

* Azure subscription with access to create Azure OpenAI resources
* Model availability varies by region

### 1. Create Azure OpenAI Resource

1. Sign in to [Azure Portal](https://portal.azure.com)
2. Select "Create a resource" and search for "Azure OpenAI"
3. Configure the resource:
   * Choose your subscription
   * Select or create a resource group
   * Choose a region
   * Name your resource
   * Select a pricing tier
4. Complete the resource creation

### 2. Deploy a Model

1. Sign in to [Azure AI Foundry portal](https://ai.azure.com)
2. Select your subscription and OpenAI resource
3. Navigate to "Deployments"
4. Click "Create new deployment"
5. Select a model (e.g., gpt-5.4)
6. Enter a deployment name (you'll use this in your configuration)
7. Configure deployment settings
8. Click "Create"

### 3. Get API Key and Resource Name

1. In the Azure Portal, go to your Azure OpenAI resource
2. Navigate to "Keys and Endpoint"
3. Copy either KEY 1 or KEY 2
4. Note your resource name from the resource overview

## Example Configuration

**In Plugin Settings → AI Gateway → Azure:**

* API Key: `abc123...`
* Resource Name: `my-openai-resource`
* API Version: `2024-02-15-preview`

**In Default Models:**

* Language Model: `azure|gpt-5.4-deployment` *(Use your deployment name, not the model name)*

## Important Notes

* **Deployment Name vs Model Name**: Use your deployment name in the configuration, not the underlying model name
* **API Version**: Azure OpenAI uses API versions. The default is usually fine, but you can specify a specific version if needed
* **Resource Name vs Base URL**: You can use either `resourceName` (simpler) or `baseURL` (for custom endpoints/gateways). When `baseURL` is provided, `resourceName` is ignored

For more information, refer to the [Azure OpenAI documentation](https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/create-resource).
