Skip to content

Latest commit

 

History

History
88 lines (59 loc) · 2.05 KB

File metadata and controls

88 lines (59 loc) · 2.05 KB

Azure OpenAI setup

How to configure the app to use Azure OpenAI directly.

When to use Azure OpenAI

Pick Azure OpenAI over Foundry when you already have AOAI resources, need a specific model version, or need regional deployment control for compliance or latency.

If you're starting fresh and don't have a strong reason to use AOAI directly, Foundry is usually simpler.

Compare providers

Prerequisites

Step 1: Create Azure OpenAI resource

# Navigate to the resource directory
cd resources-foundry

# Login to Azure
azd auth login

# Provision resources
azd up

Step 2: Get endpoint and API key

# Navigate to the resource directory
cd resources-foundry

# Login to Azure
az login

# Get endpoint
azd env get-value 'FOUNDRY_OPENAI_ENDPOINT'

# Get API key
az cognitiveservices account keys list -g rg-$(azd env get-value AZURE_ENV_NAME) -n $(azd env get-value FOUNDRY_NAME) --query "key1" -o tsv

Step 3: Store credentials

dotnet user-secrets --file ./apphost.cs set Azure:OpenAI:Endpoint "{{AZURE_OPENAI_ENDPOINT}}"
dotnet user-secrets --file ./apphost.cs set Azure:OpenAI:ApiKey "{{AZURE_OPENAI_API_KEY}}"

Step 4: Run the app

# Using file-based Aspire (recommended)
aspire run --file ./apphost.cs -- --provider AzureOpenAI

# Using project-based Aspire
aspire run --project ./src/InterviewCoach.AppHost -- --provider AzureOpenAI

Step 5: Deploy to Azure

# Login to Azure
azd auth login

# Provision + deploy
azd up

Step 6: Clean up

When finished, remove all Azure resources:

azd down --force --purge

Next steps