Microsoft offers a built-in way to ground Azure OpenAI chat models on your data, often called Azure OpenAI On Your Data. It connects a model to a data source such as Azure AI Search so users can chat over documents with little custom code. A custom RAG pipeline gives you more control. This guide compares the two.
Features and limits change, so check current Microsoft documentation before you decide. The trade-offs below are stable.
What the built-in route gives you
- A fast path to a working chat over your documents
- Less code to write and maintain
- Integration with Azure AI Search and Azure identity
- Citations back to source documents
- A good way to validate demand before investing more
Where it can fall short
- Limited control over chunking, ranking and prompts compared with your own pipeline
- Complex documents such as tables, forms and scans may need custom extraction
- Per-user permission rules may need custom design
- Evaluation, tracing and cost controls are yours to add
- Less flexibility for multi-step or agent workflows
What a custom RAG pipeline adds
With a custom pipeline you design ingestion and chunking for your documents, tune hybrid retrieval and re-ranking in Azure AI Search, apply your own prompt and citation format, filter by user identity, and add evaluation and tracing. You also choose when to use agents. The cost is more engineering up front and more to maintain.
How to decide
- If the use case is an internal tool over fairly clean documents, start with the built-in route.
- If answer quality is a product feature, build custom.
- If different users must see different documents, plan custom permission filtering.
- If documents are messy or multilingual, expect custom extraction.
- If you need agents or multi-step workflows, build custom orchestration.
A staged approach
Many teams use the built-in route to prove value, collect real questions, and measure failures. Those questions become the evaluation set for a custom pipeline if the limits start to matter. Keep source documents in your own storage and keep the question log so moving is simple.
Security and governance on Azure
Either route should use Microsoft Entra ID for access, managed identities rather than keys where possible, network controls for the services, content filtering, and logging. Decide early where prompts and responses are stored and who can read them.
A typical Azure architecture for a custom pipeline
Source files sit in Blob Storage or SharePoint. An ingestion job extracts text, splits it, creates embeddings with an Azure OpenAI embedding model and writes chunks with metadata to an Azure AI Search index. At query time the application authenticates the user with Entra ID, builds a filter from the user’s groups, runs hybrid search with semantic ranking, passes the top passages to an Azure OpenAI chat model and returns the answer with citations. Tracing goes to your monitoring service.
Designing permissions
The usual approach is to store access information, such as group identifiers, on each chunk in the index and filter by the user’s groups at query time. This is called security trimming. It needs a plan for keeping the index in step when permissions change in the source system.
Prompt and citation design
Tell the model to answer only from the supplied passages, to cite them and to say when the answer is missing. Give each passage an identifier the model can reference, then turn those references into links for the user.
Moving from the built-in route to custom
- Keep your source documents in your own storage
- Log user questions and which answers were weak
- Turn the weak questions into an evaluation set
- Rebuild retrieval and ranking in the custom pipeline and compare against the baseline
- Switch over when the custom pipeline is measurably better
Cost considerations
The main costs are model tokens, search service capacity and embeddings for indexing. A custom pipeline lets you reduce tokens by sending fewer, better passages and by choosing a smaller model for simple questions.
Evaluation: proving which route is better
Do not decide on impressions from a demo. Build a small evaluation set of 50 to 100 real questions with the expected answer and source document. Run it against the built-in route first to get a baseline. Score correctness, whether the citation is right, whether the system admits when it does not know, latency and cost per answer.
Run the same set against any custom pipeline you build. Only switch when the custom pipeline is better on the questions that matter most, not just on average. Keep the set and re-run it whenever you change prompts, models, chunking or ranking, so quality never drifts without anyone noticing.
Handling complex documents
Many internal documents are not clean text. Policies contain tables, contracts contain clauses that refer to other clauses, and older files are scanned images. A custom pipeline can use layout-aware extraction, such as Azure AI Document Intelligence, to keep tables and headings intact, and chunk by section rather than by a fixed number of characters. Each chunk should keep its document title, section heading and page number as metadata so answers can cite the exact place.
Multilingual content needs a decision too: translate at ingestion, index in the original language with a multilingual embedding model, or both. Test with real questions in each language before you choose.
Operating the system in production
- Trace each request: the question, the retrieved passages, the prompt and the answer
- Watch latency, error rates and token use per request
- Collect user feedback on answers and review the weak ones weekly
- Re-index on a schedule or on change events from the source system
- Set budgets and alerts in Azure Cost Management for the AI services
These practices matter for both routes. The built-in route reduces the code you maintain, but it does not remove the need to watch quality, cost and access once real users depend on the answers.
Common mistakes on either route
- Indexing everything at once instead of starting with the documents users actually need
- Skipping permission design until a user sees something they should not
- Using fixed-size chunks that split tables and sentences
- Sending too many passages to the model, which raises cost and can lower quality
- Launching without an evaluation set, so nobody can tell if a change helped
- Storing prompts and answers without deciding who may read them
A short decision checklist
- Who are the users, and do they all have the same access?
- How clean and consistent are the source documents?
- Is this an internal tool or part of a product customers pay for?
- What happens when an answer is wrong?
- Who will operate and improve the system after launch?
Need Azure OpenAI over your internal documents? We can help you pick the route and build it.
Discuss your initiative





