
Accounts receivable turnover ratio: formula and benchmarks
Accounts receivable turnover ratio explained: the formula, benchmarks for manufacturers and distributors, and how to convert it to DSO for your board.
Home » How to Build a RAG Application on Azure: Architecture, Tools, and Gotchas
RAG Azure OpenAI (Retrieval-Augmented Generation on Azure) is the architecture pattern enterprise teams are adopting to get GPT-4-class answers grounded in their own proprietary data, without retraining any model. Instead of asking GPT-4 to memorise your product catalog, compliance documents, or customer support history, RAG retrieves the right context at query time and injects it directly into the model prompt. The result is accurate, citable, auditable responses built on your actual business data. Whether you are building this in-house, evaluating an azure consulting services partner, or planning this as part of a broader azure app modernization programme, this guide covers the full architecture, Azure-specific tooling, the five build steps, the common gotchas, and what production actually requires.
Eager to discuss about your project?
Share your project idea with us. Together, we’ll transform your vision into an exceptional digital product!
Book an Appointment nowRAG in Azure OpenAI is an architecture pattern that combines Azure AI Search (vector retrieval) with Azure OpenAI Service (text generation) to produce answers grounded in a private document corpus, without fine-tuning the underlying model.
A standard GPT-4 deployment knows nothing about your internal data and has a knowledge cutoff. RAG solves this by splitting the problem into two stages. Your documents are chunked, embedded using text-embedding-3-large, and stored as vectors in Azure AI Search. When a user asks a question, the system embeds that query, retrieves the top-k semantically similar chunks, and passes them as context in a GPT-4 prompt. The model answers using that grounded context and cites its sources.
Understanding where RAG fits in the Azure AI tooling helps before you start building. Our comparison of Azure AI Foundry vs Azure OpenAI Service explains how Foundry adds orchestration, evaluation, and safety tooling on top of the base OpenAI Service, which matters for production RAG systems that need quality gates.
Fine-tuning writes knowledge into model weights. Every time your data changes, you re-run training, pay for compute, and re-test the model. It is also opaque: you cannot audit why a specific answer was generated. RAG keeps knowledge in a search index you update daily, version-control, and restrict per user role. For banking, healthcare, or legal teams, that auditability is a hard requirement. It is also significantly cheaper to update an index than to re-run a training job every time your policies change.
Yes, through the "Add Your Data" feature in Azure AI Studio. Point it at a blob container or SharePoint site and it handles chunking, embedding, and retrieval automatically. It works well for prototyping but limits your control: you cannot tune chunk size, adjust re-ranking, or apply document-level security trimming. Enterprise teams outgrow it within weeks. A custom pipeline built with Semantic Kernel or LangChain is what production requires.
A production rag azure openai system uses five layers working together:
| Layer | Azure Service | Purpose |
|---|---|---|
| Document store | Azure Blob Storage | Raw PDFs, DOCX, HTML source files |
| Vector store | Azure AI Search | Chunked embeddings with metadata and security fields |
| Orchestration | Semantic Kernel or LangChain | Query pipeline, hybrid search, re-ranking |
| Generation | Azure OpenAI Service (GPT-4o) | Answer synthesis from retrieved context |
| Security | Azure Key Vault + Azure AD RBAC | Secrets, managed identity, access control |
If your team writes C#, Semantic Kernel is the right fit. Microsoft built it for azure openai rag c# workflows and it integrates cleanly with Azure managed identity, Azure AI Search, and the broader .NET stack. Python teams reach for LangChain or LlamaIndex, both of which have first-class azure ai search rag support. The azure openai rag python quickstarts on Microsoft Learn use LangChain for this reason. Teams running power automate consulting work should note that neither framework connects to Power Platform natively. You expose the RAG layer as an API and Power Platform consumes it via a custom connector.
If your documents sit on-premise or in a hybrid cloud azure setup, run the ingestion pipeline in VNet-integrated compute (Azure Container Apps or AKS) with Express Route or VPN Gateway connecting back to your data centre. This pattern is common for teams doing migrate on premise to azure projects where sensitive data cannot leave the corporate network yet. An azure infrastructure assessment early in the project confirms whether your existing network topology supports this or needs rearchitecting before ingestion code is written.
The 5 steps to build a RAG app on Azure are: provision and configure core services, build the document ingestion pipeline, implement retrieval and orchestration, wire the generation step with prompt engineering, and deploy with CI/CD and monitoring.
Start with an azure architecture review to confirm your tenant supports private endpoints and that your Azure AD configuration is clean. Create an Azure AI Search resource at Standard S1 tier minimum for semantic ranking, and an Azure OpenAI deployment with access to gpt-4o and text-embedding-3-large. Store all API keys in Azure Key Vault and use managed identity throughout. If you are starting from an azure landing zone implementation with networking, RBAC, and policies already configured, this step takes two to three days. Without a landing zone, budget a full week for governance setup before a single document gets ingested.
This is consistently where teams underestimate the work. Ingestion requires extracting text from PDFs, DOCX, and HTML (Azure Document Intelligence handles complex tables and multi-column layouts), chunking into 512-1024 token segments with 10-20% overlap, embedding each chunk via Azure OpenAI, and indexing with metadata including source URL, document date, and access tier. Microsoft's azure-search-openai-demo on GitHub is the canonical azure openai rag github reference for this pattern. Deploy it as an Azure Function or Container App that watches Blob Storage for new uploads and processes them automatically.
Key Insight Ingestion requires extracting text from PDFs, DOCX, and HTML (Azure Document Intelligence handles complex tables and multi-column layouts), chunking into 512-1024 token segments with 10-20% overlap, embedding each chunk via Azure OpenAI, and indexing with metadata including source URL, document date, and access tier.
Query Azure AI Search using hybrid search: vector similarity combined with BM25 keyword matching. Azure AI Search's semantic ranker re-ranks the top-k results before they reach the model. Pure vector search misses exact-match queries that BM25 catches. Apply security trimming filters at query time so each user only retrieves document chunks their Azure AD group authorises. This is non-negotiable for multi-tenant or regulated deployments and should be wired in from the first sprint, not added later.
Pass retrieved chunks as context in the system prompt, followed by the user's question. Instruct the model explicitly to answer only using the provided context and to cite the source document name for each factual claim. Keep the system prompt under 1,000 tokens to leave room for context and the response. Without citation logic, users have no way to verify a claim, which kills adoption in banking and healthcare environments where traceability is mandatory.
Use Azure Pipelines or GitHub Actions for infrastructure-as-code deployment. Teams already familiar with Azure Pipelines YAML for .NET projects will recognise the same approval gate patterns applied here. Log every query-answer pair to Azure Application Insights for latency tracking and quality monitoring. Set budget alerts in Azure Cost Management to catch token usage spikes, which frequently signal prompt injection attempts or misconfigured chunk sizes pushing context windows to their limits.
Most azure openai rag tutorials stop at "it works in the notebook." In our experience at QServices, these are the production failure modes teams encounter most often.
Teams default to 1024-token chunks because that is in the documentation. The right chunk size depends on your document type. Dense legal contracts need 256-token chunks to isolate individual clauses. Knowledge base articles work at 512 tokens. Policy documents with long continuous arguments work at 1024. If retrieval quality is poor, chunk size and overlap settings are the first variables to tune before touching the model or prompt. This single change often improves answer faithfulness scores by 20-30%.
Key Insight This single change often improves answer faithfulness scores by 20-30%.
Azure AI Search supports security trimming: store an allowed_groups field per document chunk and filter at query time using the user's Azure AD token. Without it, users retrieve documents they have no business seeing. An azure security assessment at project start surfaces this requirement before it becomes a breach incident. This is also where power platform governance matters: if a power platform development company builds connectors to your RAG API, or Power Apps development services teams create flows that call it directly, those clients inherit the security model, or bypass it entirely if enforcement is not at the API layer.
Azure rag pricing has three components: Azure OpenAI token costs for embedding and generation, Azure AI Search compute and storage, and orchestration compute. In our client engagements, a mid-market team processing 500,000 documents and handling 5,000 daily queries typically pays a moderate monthly bill that varies with the GPT-4o tier and search tier selected. Azure cost optimization work commonly brings this down substantially through prompt compression, query result caching, and right-sizing the search index. The specific levers are covered in detail in Azure Cost Optimisation: 9 Levers Engineering Teams Use.
QServices is a Microsoft Certified Solutions Partner specialising in Azure, and we have completed 500+ Azure and Microsoft platform projects since 2014. As a microsoft azure consulting company and azure migration partner for enterprise clients in banking, healthcare, logistics, and SaaS, we have run RAG engagements at every scale. The structure we follow is consistent across sectors.
Every RAG engagement begins with an azure infrastructure assessment: we audit the tenant configuration, data residency requirements, identity model, and network topology before writing any code. Alongside this, we run a full azure architecture review and an azure security assessment to confirm that private endpoints, document-level access control, and audit logging are designed in from day one. We also evaluate whether the document storage layer suits a lift and shift to azure approach or needs to be cloud-native from the start, which affects the ingestion pipeline architecture significantly.
The build phase uses azure devops consulting services-style CI/CD from the first sprint: every component in source control, every deployment behind an approval gate. That aligns with the Human-in-the-Loop governance principle detailed in our AI Agent Governance post, ensuring human approval at every deployment stage. We apply the NIST AI Risk Management Framework to enterprise RAG deployments, covering bias controls, robustness requirements, and traceability. We also implement power platform governance controls to prevent low-code developers from calling the RAG API without rate limiting or audit logging, a gap that often appears when power automate consulting teams build connectors without a security review step.
As an azure managed services provider, QServices handles ongoing RAG operations: monthly architecture reviews, Azure OpenAI model version upgrades, embedding re-indexing when Azure updates its embedding models, and cost reporting dashboards built by our power bi consulting services team so RAG system owners have real-time visibility into query volumes, retrieval latency, and token costs. Teams doing azure app modernization of legacy .NET services alongside a RAG build, or running azure cloud migration services projects that move document storage to Blob Storage, get both workstreams managed under one account. The same VNet, identity model, and monitoring setup serves both, making co-delivery faster and cheaper than running them separately. See Legacy App Modernization: When to Rewrite, Refactor, or Replace for the framework we use when legacy systems need to expose data to the RAG layer.
Talk to an Azure AI Architect at QServices and we will map your data sources, identity model, and scale requirements to the right RAG design, then deliver a production architecture document within two weeks.
Building a rag azure openai system that holds up in production, not just in a proof-of-concept, is a 10-17 week project for most enterprise teams. The gap between demo and production sits in four specific areas: chunk size tuning for your document types, document-level security filtering, hybrid search configuration, and ongoing RAG evaluation metrics. The azure rag architecture decisions made in week one, specifically the search tier, access control model, and orchestration framework, determine how much rework you face in month three. Done right, RAG on Azure gives your organisation a secure, auditable AI layer over proprietary knowledge that no public model can replicate. Talk to an Azure AI Architect at QServices. We will start with an azure infrastructure assessment and azure architecture review and deliver a production-ready architecture in your hands within two weeks.

Written by Rohit Dabra
Co-Founder and CTO, QServices IT Solutions Pvt Ltd
Rohit Dabra is the Co-Founder and Chief Technology Officer at QServices, a software development company focused on building practical digital solutions for businesses. At QServices, Rohit works closely with startups and growing businesses to design and develop web platforms, mobile applications, and scalable cloud systems. He is particularly interested in automation and artificial intelligence, building systems that automate routine tasks for teams and organizations.
Talk to Our ExpertsRAG in Azure OpenAI is an architecture pattern that combines Azure AI Search for vector retrieval with Azure OpenAI Service for text generation. It grounds model responses in your private document corpus without fine-tuning, by chunking and embedding your documents into Azure AI Search, then retrieving the most relevant chunks at query time and passing them as context to GPT-4o. The model answers using only that retrieved context and cites the source documents.
Azure OpenAI’s built-in RAG capability is the “Add Your Data” feature in Azure AI Studio, which handles chunking, embedding, and retrieval automatically when pointed at a blob container or SharePoint site. It is suitable for prototyping. Production deployments typically require a custom pipeline built with Semantic Kernel or LangChain to control chunk size, security trimming, hybrid search configuration, and evaluation metrics that the native feature does not expose.
To implement RAG in Azure, follow five steps: (1) Provision Azure AI Search and Azure OpenAI Service with managed identity and Azure Key Vault for secrets; (2) Build an ingestion pipeline that chunks documents and stores embeddings in Azure AI Search with metadata; (3) Implement hybrid search combining vector similarity and BM25 with semantic re-ranking and Azure AD security trimming; (4) Engineer a system prompt that passes retrieved context to GPT-4o and instructs source citation; (5) Deploy via Azure Pipelines with Application Insights monitoring and Cost Management budget alerts.
Yes. Snowflake can act as a secondary retrieval source alongside Azure AI Search in a RAG workflow. Snowflake’s Arctic Embed models generate embeddings directly from structured data, while Azure AI Search handles unstructured document retrieval. The orchestration layer, using Semantic Kernel or LangChain, routes queries to the right source based on intent classification. This hybrid approach is valuable when RAG needs to answer questions spanning both product databases in Snowflake and policy documents indexed in Azure AI Search.
An Azure managed services provider like QServices handles ongoing RAG operations including monthly architecture reviews, Azure OpenAI model version upgrades, embedding re-indexing when Microsoft updates its embedding models, security posture reviews, cost optimisation reporting, and query quality evaluation using tools like RAGAS or Azure AI Foundry’s evaluation harness. This allows your internal team to focus on the application layer while the managed services provider keeps the AI infrastructure current, compliant, and within budget.

Accounts receivable turnover ratio explained: the formula, benchmarks for manufacturers and distributors, and how to convert it to DSO for your board.

Plan your NAV to Business Central migration before NAV 2018 support ends on 11 Jan 2028. Compare online vs on-premises and size the C/AL to AL rewrite.

Use this ERP data migration checklist to clean customers, vendors, items and open AR/AP before a Business Central move. Your team approves every merge.
Eager to discuss about your project?
Share your project idea with us. Together, we’ll transform your vision into an exceptional digital product!
Book an Appointment now
Accounts receivable turnover ratio explained: the formula, benchmarks for manufacturers and distributors, and how to convert it to DSO for your board.

Plan your NAV to Business Central migration before NAV 2018 support ends on 11 Jan 2028. Compare online vs on-premises and size the C/AL to AL rewrite.

Use this ERP data migration checklist to clean customers, vendors, items and open AR/AP before a Business Central move. Your team approves every merge.

Dynamics GP to Dynamics 365 migration explained: what Microsoft’s cloud tool moves, how history is handled, and how to validate balances before cutover.
Every quote comes from a published review on GoodFirms, Clutch or our own site. Click a source to read the full review.
Trustpilot5.0★★★★★See reviewsGoodFirms5.0★★★★★45 verified reviews
G25.0★★★★★See reviewsClutch5.0★★★★★Quality 5.0 · Schedule 4.8
Google4.7★★★★★Mohali office“QServices was highly professional, knowledgeable, and approachable. We continue to work with them on other projects.”
“Quality assurance is often overlooked, but these guys take that very seriously. … their team of experienced, dedicated developers and highly skilled engineers quickly dissected and decomposed every problem and presented solutions and options that directly met my needs”
Erik BrownBusiness owner and software engineerClient review“The supplier delivered the application on time and was responsive to our needs. He was also flexible, which allowed us to make changes on the fly.”
Zoltan BodnarCFO, Yusen LogisticsGoodFirms“Thank you Sahil and team for wonderful collaboration right from day 0. … Highly recommend the developers.”
Ranbeer MakinClientClient review“They are always looking for new ways to improve their products and services and to deliver value to their customers.”
“I have had an excellent experience working with QServices. We have a highly collaborative relationship and I value them not just as contractors but as partners.”
Alex VanderElsClientClient review“Sahil undertakes every project with a high degree of professionalism. His communication style is unmatched and he is always available to resolve issues or just discuss the project.”
Philmore J.ClientClient review“Responsive, patient and professional. Consistent weekly attention to our project, and new ideas we hadn't asked for.”
Michael WilliamsonPresident and CEO, United Way of Southeast LouisianaGoodFirms“I have been working with them on a project for a year now … They have been able to solve problems that come up with bugs or development and able to communicate well with me.”
Steven LewisClientClient review“We had been working on the app for two years. QServices built it in two months.”
Brian WallerPresident, Technology Association of IowaGoodFirms“All projects were delivered on time and were fully completed upon delivery.”
“They had excellent quality. The hypercare they provided after the project went live is exceptional.”

Founder and CEO

Chief Sales Officer
Thanks, we’ve got your details. A named member of our team will reply within one business day.
You leave the call with
What should we cover on the call?
Pick one so the right person joins. You choose the time next.
Pick a time for the call