How to configure the app to use Azure OpenAI directly.
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.
- Azure subscription (Get one free)
- Azure Developer CLI installed (Download)
- Azure CLI installed (Download)
# Navigate to the resource directory
cd resources-foundry
# Login to Azure
azd auth login
# Provision resources
azd up# 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 tsvdotnet 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}}"# Using file-based Aspire (recommended)
aspire run --file ./apphost.cs -- --provider AzureOpenAI
# Using project-based Aspire
aspire run --project ./src/InterviewCoach.AppHost -- --provider AzureOpenAI# Login to Azure
azd auth login
# Provision + deploy
azd upWhen finished, remove all Azure resources:
azd down --force --purge