A sample application demonstrating Retrieval Augmented Generation (RAG) with Azure AI Search and Azure OpenAI Service. This project creates a ChatGPT-like experience over your own documents, combining powerful GPT models with enterprise-grade search for knowledge retrieval.
- Multi-turn chat interface with citations and reasoning steps
- Document indexing and retrieval via Azure AI Search (supports PDFs, docs, cloud data)
- Configurable UI for experimenting with prompts and behaviors
- Optional multimodal support for image-heavy documents
- Speech input/output for accessibility
- Microsoft Entra integration for secure login and data access
- Performance monitoring with Application Insights
IMPORTANT: In order to deploy and run this example, you'll need:
- Azure account. If you're new to Azure, get an Azure account for free and you'll get some free Azure credits to get started. See guide to deploying with the free trial.
- Azure account permissions:
- Your Azure account must have
Microsoft.Authorization/roleAssignments/writepermissions, such as Role Based Access Control Administrator, User Access Administrator, or Owner. If you don't have subscription-level permissions, you must be granted RBAC for an existing resource group and deploy to that existing group. - Your Azure account also needs
Microsoft.Resources/deployments/writepermissions on the subscription level.
- Your Azure account must have
Pricing varies per region and usage, so it isn't possible to predict exact costs for your usage. However, you can try the Azure pricing calculator for the resources below.
- Azure Container Apps: Default host for app deployment as of 10/28/2024. See more details in the ACA deployment guide. Consumption plan with 1 CPU core, 2 GB RAM, minimum of 0 replicas. Pricing with Pay-as-You-Go. Pricing
- Azure Container Registry: Basic tier. Pricing
- Azure App Service: Only provisioned if you deploy to Azure App Service following the App Service deployment guide. Basic Tier with 1 CPU core, 1.75 GB RAM. Pricing per hour. Pricing
- Azure OpenAI: Standard tier, GPT and Ada models. Pricing per 1K tokens used, and at least 1K tokens are used per question. Pricing
- Azure AI Document Intelligence: SO (Standard) tier using pre-built layout. Pricing per document page, sample documents have 261 pages total. Pricing
- Azure AI Search: Basic tier, 1 replica, free level of semantic search. Pricing per hour. Pricing
- Azure Blob Storage: Standard tier with ZRS (Zone-redundant storage). Pricing per storage and read operations. Pricing
- Azure Cosmos DB: Only provisioned if you enabled chat history with Cosmos DB. Serverless tier. Pricing per request unit and storage. Pricing
- Azure AI Vision: Only provisioned if you enabled multimodal approach. Pricing per 1K transactions. Pricing
- Azure AI Content Understanding: Only provisioned if you enabled media description. Pricing per 1K images. Pricing
- Azure Monitor: Pay-as-you-go tier. Costs based on data ingested. Pricing
This project demonstrates a Retrieval Augmented Generation (RAG) chat experience using Azure AI Search and Azure OpenAI Service with Python. You can run it in three ways: GitHub Codespaces, VS Code Dev Containers, or your local environment.
The fastest way to try this repo without installing anything locally.
- Click Open in GitHub Codespaces from the repo.
- Wait for the codespace to initialize (may take several minutes).
- Once VS Code opens in your browser, open a terminal window.
A reproducible local environment using Docker.
- Install Docker Desktop (start it after installation).
- Install the Dev Containers extension in VS Code.
- Open the project in VS Code → select Open in Dev Container.
- Wait for the container to build (may take several minutes).
- Once the project files appear, open a terminal window.
For full control and direct deployment to Azure.
- Azure Developer CLI
- Python 3.10–3.14 (ensure
python --versionworks) - Node.js 20+
- Git
- PowerShell 7+ (Windows only, ensure
pwsh.exeruns)
# Create a new folder and switch to it
mkdir my-rag-chat && cd my-rag-chat
# Initialize the project
azd init -t azure-search-openai-demoThis provisions resources and deploys the app.
# Login to Azure
azd auth login
# (Codespaces users may need: azd auth login --use-device-code)
# Create a new environment
azd env new
# Deploy resources and app
azd up⚠️ Note: Resources incur costs immediately (especially AI Search). Runazd downto delete resources when finished.- After deployment, a URL will be printed. Open it in your browser to use the app.
Deployment may take 5–10 minutes after
SUCCESS.
- If only app code changed:
azd deploy
- If infra files changed (
infra/ orazure.yaml):azd up
You can run the dev server after a successful azd up.
# Login if needed
azd auth login
# Start the server
# Windows
./app/start.ps1
# Linux/Mac
./app/start.shOr run the VS Code Task: Start App.
Access locally at: http://127.0.0.1:50505
- Ask questions about the sample company data (benefits, policies, roles).
- Try multi-turn conversations, clarifications, and follow-ups.
- Explore citations and sources.
- Use Settings to tweak prompts and behaviors.
To delete all Azure resources created:
Confirm with y when prompted. This deletes the resource group and all resources.
azd down
