Most organisations have no shortage of information. Policies sit in SharePoint, operational guidance lives in PDFs, product knowledge is spread across wikis, and important decisions are buried in project documents. The difficulty is finding the right information, understanding whether it is current and knowing whether the person asking is allowed to see it.
Retrieval-augmented generation (RAG) is a pattern for connecting a language model to selected knowledge sources. The application retrieves relevant content, supplies it as grounding context and asks the model to produce an answer that can point back to its sources. RAG can improve usefulness for organisation-specific questions, but it does not automatically make answers correct or secure.
Explore an enterprise RAG system
Select each stage to see how trusted knowledge becomes a grounded answer.
Connect authoritative sources
Select approved knowledge sources and preserve each document’s owner, version, classification and access rules.
Try selecting each stage. The moving signal illustrates the flow of knowledge through the system.
1. Start with a bounded knowledge problem
A successful first release is usually narrower than “chat with all company data”. Choose a real workflow with identifiable users, source material and success criteria. Examples include helping service teams find approved troubleshooting guidance, enabling employees to locate current HR policies, or helping analysts understand documented business definitions.
Define what the assistant may answer, what it must refuse or route to a person, which sources are authoritative and what a useful answer looks like. Identify the cost of a wrong answer. A policy lookup assistant and a system that recommends regulated decisions need very different controls.
2. Prepare content before embedding it
Retrieval quality is limited by the quality of the knowledge being indexed. Inventory sources and owners first. For each source, record its authority, update frequency, access model, retention requirements and whether it contains personal, confidential or regulated information.
- Extract carefully: preserve headings, tables, page references and document structure where they carry meaning. Treat OCR output as uncertain until checked.
- Normalise: remove navigation clutter and duplicate boilerplate without stripping qualifications, exceptions or context.
- Chunk by meaning: split around sections and coherent topics rather than using a single arbitrary character count. Keep enough context for a passage to make sense.
- Attach metadata: store source ID, title, URL, section, owner, version, effective date, classification and permission attributes with each chunk.
- Synchronise lifecycle changes: update changed documents and propagate deletions, expiries and permission revocations to derived chunks, indexes and caches.
Do not assume that a successful embedding job means the knowledge base is ready. Measure extraction errors, duplicate content, stale documents and missing metadata before exposing the index to users.
3. Choose retrieval for the content and questions
Vector search can find passages with related meaning even when wording differs. Keyword search is valuable for exact names, codes, product IDs and policy terms. Hybrid retrieval combines lexical and vector signals; reranking can then improve the ordering of a candidate set. These are options to test, not features that should be added by default.
Build a representative evaluation set from real questions, including ambiguous requests, exact identifiers, questions with no answer in the corpus and questions whose answer depends on a particular document version. Measure whether the right source appears in the top results before tuning the generation prompt.
When users ask follow-up questions, decide how conversational context changes the search query. Preserve the original question and the rewritten query in diagnostic traces so retrieval failures can be understood.
4. Enforce permissions before content reaches the model
This is one of the most important enterprise design decisions. A user who cannot open a restricted source document should not be able to retrieve its chunks through an assistant. Checking permissions only when documents are ingested is not enough: access can change after indexing.
Carry permission metadata from the source to every chunk. At query time, derive the caller's identity and group memberships from a trusted authentication flow, then apply security trimming in the retrieval layer. Do not ask the language model to decide whether the user is authorised. Do not rely on a client-supplied role or filter that the server has not validated.
Who can retrieve which knowledge?
Switch the signed-in role to see how server-side security trimming changes the available evidence.
Only the employee handbook can be passed to retrieval for this user.
Demo roles are illustrative. Real permissions must come from your identity provider and source-system ACLs—not a user-selected control.
For multi-tenant systems, make tenant boundaries explicit in the index and query path. Also isolate caches: a response generated for one user's permissions must not be returned to another user with a different access scope. Test revoked access, nested groups, shared links and service identities.
Microsoft documents several approaches for document-level access control in Azure AI Search, including security filters and permission-aware options for supported sources. Check feature status and limitations carefully: some integrations are marked preview and may not be appropriate for production workloads.
5. Treat retrieved documents as untrusted data
RAG introduces an indirect prompt-injection risk. A document or web page can contain text that attempts to instruct the model to ignore its rules, reveal secrets or call a tool. Retrieved content should be treated as evidence to analyse—not as instructions that outrank the application's trusted system logic.
- Keep system instructions and tool permissions outside the retrieved content.
- Clearly delimit passages and label them as untrusted source material.
- Do not place secrets, credentials or unrestricted tool capabilities in the model context.
- Validate tool calls and sensitive actions in application code, with authorisation independent of model output.
- Test malicious documents, hidden text, poisoned sources and attempts to cross tenant boundaries.
Grounding also needs a clear failure path. If retrieval finds no sufficiently relevant evidence, the assistant should say it cannot find a supported answer, ask a clarifying question or route the request to the right team—not manufacture a confident response.
6. Make citations useful and verifiable
A citation should help a reader check the answer. Preserve stable source identifiers and useful locations such as document title, section, page or URL. Generate citations from the actual retrieved passages, not from a model-generated guess. Where possible, make the cited source open at the relevant location and show its version or effective date.
Evaluate whether citations support the claims they accompany. A response can contain a valid source link that does not actually substantiate the sentence. For high-impact workflows, require users to review the source before acting.
7. Evaluate retrieval and generation separately
Do not measure a RAG assistant only by whether users like its answers. A practical evaluation programme has several layers:
- Retrieval: did the system find the expected source and relevant passage? Track recall at K, ranking quality and no-result behaviour.
- Grounding: are important claims supported by the retrieved evidence? Are citations accurate and complete?
- Answer quality: is the response correct, clear, relevant and appropriately qualified?
- Security: can a user retrieve restricted content, exploit a poisoned document or receive another user's cached answer?
- Operations: are latency, token use, index freshness, failures and cost within agreed limits?
Maintain a test set and rerun it when source content, chunking, embedding models, ranking, prompts or model versions change. Combine automated checks with expert review for the workflows where errors have material consequences.
8. A practical four-week rollout
- Week 1 — Scope and source audit: choose one workflow, identify users and owners, map authoritative sources, classify data and define measurable acceptance criteria.
- Week 2 — Ingestion and retrieval: build a small index, preserve metadata and permissions, implement keyword or hybrid retrieval, and create a representative question set.
- Week 3 — Secure answer experience: add server-side access enforcement, citations, refusal and escalation behaviour, prompt-injection tests and operational logging.
- Week 4 — Pilot and improve: run user acceptance tests, review retrieval misses and unsupported answers, test permission changes, document limitations and agree the next release gate.
This is an example delivery sequence, not a promise that every enterprise implementation can be completed in four weeks. Source complexity, identity integration, compliance requirements and existing platform maturity can materially change the effort.
Frequently asked questions
Does RAG eliminate hallucinations?
No. Retrieval can provide relevant evidence, but the model can still misinterpret it, overlook important context or make unsupported claims. Evaluation, citations, refusal behaviour and human review remain important.
Should every company use vector search?
No. Exact identifiers and structured metadata may be better served by keyword or database queries. Test lexical, vector and hybrid approaches against the questions users actually ask.
Can we use one index for every department?
Potentially, but only with a robust permission model enforced at retrieval time and tested for every access path. Separate indexes or stores may be more appropriate where tenant, regulatory or operational isolation requirements demand them.
What should we monitor after launch?
Track retrieval quality, answer grounding, citation validity, permission denials, index freshness, user feedback, latency, cost and security events. Assign owners to review these signals and respond to incidents.
Test more than the final answer
Choose an evaluation layer to see what a production RAG quality programme should measure.
Did we find the right evidence?
Measure whether expected documents and passages appear near the top of the retrieved results for representative questions.
Build a repeatable test set and rerun it whenever content, retrieval settings, prompts or model versions change.
Conclusion: make trust part of the architecture
Enterprise RAG is not simply a vector database connected to a chat interface. It is a knowledge pipeline with source governance, identity-aware retrieval, model orchestration, evaluation and operational ownership. The most useful systems start with a specific workflow and make security and evidence visible from the beginning.
For organisations exploring AI assistants, the best next step is often a bounded proof of value using a small set of authoritative sources—then expand only when retrieval quality, access controls and user outcomes are demonstrated.
Further reading
- Microsoft Foundry: Retrieval-augmented generation and indexes — RAG workflow, security and operational considerations.
- Azure AI Search: Document-level access control — approaches to permission-aware retrieval and security filters.
- OWASP: Retrieval-Augmented Generation Security Cheat Sheet — practical security risks and controls across the RAG lifecycle.
- Where AI agents fit in modern data engineering — related patterns for agentic workflows.
- TierShift AI Engineering — AI application and agent engineering services.
Planning an enterprise AI assistant?
TierShift helps teams connect data foundations, secure retrieval and AI engineering into practical business workflows.
Talk to TierShift →