Azure OpenAI Setup Guide
This guide walks you through deploying an Azure OpenAI model using Microsoft Foundry. The deployed model powers the AI answer synthesis for your RAG retriever.
Prerequisites
- An Azure account with an active subscription
- Owner access to the subscription (to create a Foundry resource), or an existing Foundry resource
- A supported region (East US 2, Sweden Central recommended for latest models)
Part A: Access Microsoft Foundry Portal
1. Navigate to the Portal
- Go to ai.azure.com
- Sign in with your Azure account credentials
2. Enable the New Foundry Experience
- Look for the "Try the new Foundry" toggle in the portal header
- Turn the toggle ON for the latest experience
Note: All links to Microsoft Foundry open whichever portal version you last used.
Part B: Create a Foundry Project
Skip this section if you already have a Foundry project.
1. Create New Project
- Click your project name in the upper-left corner
- Select "Create new project"
2. Configure Settings
| Setting | Recommendation |
|---|---|
| Project name | Descriptive name (e.g., "MyCompany RAG Project") |
| Resource group | Select existing or create new |
| Location | East US 2 or Sweden Central for GPT-4o/GPT-5 |
- Click "Create project" and wait for completion (1-2 minutes)
Part C: Deploy an Azure OpenAI Model
1. Navigate to Models
- Click "Discover" in the upper-right navigation
- Select "Models" in the left pane
2. Find Your Model
Search for or browse to your desired model:
| Model | Best For |
|---|---|
gpt-4o | High-quality answers, production use |
gpt-4o-mini | Cost-effective, good quality |
gpt-4.1-mini | Latest capabilities, cost-effective |
3. Deploy the Model
- Click "Deploy" → "Custom settings"
- Configure:
- Deployment name: e.g.,
gpt-4o-rag - Deployment type: Global Standard (recommended)
- Deployment name: e.g.,
- Click "Deploy"
- Wait for deployment (1-5 minutes)
Part D: Get Your Endpoint and API Key
Understanding Foundry Endpoints
Foundry shows multiple endpoints - use the correct one:
| Endpoint Type | URL Pattern | Use For |
|---|---|---|
| ❌ Project Endpoint | services.ai.azure.com/api/projects/... | Foundry APIs only |
| ✅ Model Target URI | cognitiveservices.azure.com/openai/... | Model inference |
Warning: Use the
cognitiveservices.azure.comURL, NOT theservices.ai.azure.comURL.
1. Navigate to Your Deployment
- Click "Build" in the upper-right navigation
- Select "Models" in the left pane
- Find your deployment in the list
- Click the radio button (selection circle) next to the deployment to open details
Tip: Don't click the deployment name - that opens the Playground. Click the radio button instead.
2. Get the Endpoint URL
- Look for the Target URI field (NOT "Project endpoint")
- You'll see a URL like:
https://your-resource.cognitiveservices.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-05-01-preview - Copy just the base URL:
https://your-resource.cognitiveservices.azure.com/
Note: The wizard automatically strips the path if you paste the full Target URI.
3. Get the API Key
- Click "View code" or "Code" tab
- Find the
api-keyvalue in the code examples - Copy the key (32+ characters)
4. Note Your Deployment Name
The deployment name (e.g., gpt-4o) is visible in:
- The Target URI path
- The deployment list
- The deployment details panel
Summary: Information for the Wizard
| Field | Example |
|---|---|
| Display Name | My Azure OpenAI |
| Endpoint URL | https://your-resource.cognitiveservices.azure.com/ |
| API Key | (32+ character key) |
| Deployment Name | gpt-4o |
Troubleshooting
"No quota available in this region"
- Try East US 2, Sweden Central, or West Europe
- Request quota increase via Azure support
"Model not available"
- Some models require registration
- Try
gpt-4o-miniwhich is generally available
Endpoint shows wrong format
- Use Target URI (
cognitiveservices.azure.com), not Project endpoint (services.ai.azure.com) - Both
cognitiveservices.azure.comandopenai.azure.comformats work
Can't find Target URI
- Click the radio button next to the deployment, not the name
- Look in the details panel that appears on the right