Forum Discussion
dramaraj
Microsoft
Nov 29, 2026Beyond Basic RAG: Building a Production-Ready Enterprise Knowledge Base with Microsoft Foundry
Enterprise knowledge rarely lives in one place.
Architecture decisions might be documented in collaboration platforms. Engineering context can live in work-item systems and source-control repositories. Operational procedures may be stored as documents. Product information may come from databases or APIs.
When organizations start building generative AI applications over this information, an early architecture often looks straightforward:
Documents → Chunking → Embeddings → Vector Index → LLM
That is a useful prototype.
But a production enterprise knowledge base needs to solve a much broader set of problems:
- How do we continuously ingest knowledge from multiple enterprise systems?
- What happens when only one document changes?
- How do we prevent outdated chunks from remaining searchable?
- How do we preserve document and chunk lineage?
- How do we combine semantic similarity with exact terminology?
- How do we respect the permissions of the original information?
- How do we measure whether the knowledge base is fresh and retrieval is working correctly?
This article presents a reusable architecture for solving those problems with Microsoft Foundry and Foundry IQ (Azure AI Search).
The objective is not simply to build a chatbot.
The objective is to build a trusted enterprise knowledge layer that can support multiple AI applications over time.
1. From RAG Prototype to Enterprise Knowledge Platform
Retrieval-augmented generation, or RAG, connects generative AI applications to private organizational knowledge.
At a high level, the pattern is simple:
- Prepare enterprise content.
- Divide large content into smaller searchable units.
- Generate embeddings.
- Index the content and metadata.
- Retrieve relevant information for a user query.
- Provide that information as grounding context to the model.
- Generate an answer grounded in retrieved enterprise knowledge.
Microsoft Foundry supports RAG workflows by connecting applications to indexes or retrieval services. Foundry IQ (Azure AI Search) can provide the indexing and retrieval layer.
For production systems, however, I find it useful to think about the solution as two separate paths:
Knowledge path
Enterprise Sources
→ Change Detection
→ Ingestion
→ Parsing and Normalization
→ Metadata and ACL Processing
→ Chunking
→ Embeddings
→ Search Index
→ Version Activation
Query path
User Query
→ Identity and Access Context
→ Query Processing
→ Hybrid Retrieval
→ Security Filtering
→ Ranking
→ Context Assembly
→ Grounded Response
Separating these paths makes the architecture easier to scale, observe, secure and evolve.
2. Reference Architecture
A reusable enterprise knowledge architecture can be organized into six layers.
Layer 1: Enterprise Knowledge Sources
Knowledge can originate from many systems:
- Enterprise documentation platforms
- Work-item and engineering systems
- Source-control repositories
- SharePoint and document repositories
- Azure Blob Storage
- Databases
- Business applications
- Enterprise APIs
Each source has different characteristics.
A document repository may provide files and metadata. A work-item system contains structured records. A source-control repository contains code and documentation. Some platforms provide webhooks, while others require scheduled polling or incremental synchronization.
Because of these differences, source-specific connectors should be isolated from the rest of the knowledge pipeline.
The rest of the architecture should operate on a common internal document representation.
3. Ingestion Should Be Event-Driven and Incremental
One of the most important production design decisions is how changes propagate through the knowledge base.
A simple implementation periodically rebuilds everything.
That approach becomes increasingly expensive as the knowledge base grows.
A better model is:
Source Change → Event / Polling → Queue → Ingestion Worker → Processing → Index Update
The event can indicate a:
- document creation,
- document update,
- document deletion,
- permission change, or
- metadata change.
The event should contain enough information to locate the affected source object without carrying the entire document through the messaging layer.
A canonical event could conceptually contain:
- source system,
- source document identifier,
- event type,
- source version,
- event timestamp,
- correlation ID.
The important principle is:
Changes should trigger selective reprocessing rather than rebuilding the entire knowledge base.
4. Build a Canonical Document Model
Different sources represent content differently.
Before chunking and indexing, normalize them into a common representation.
A normalized document might conceptually contain:
- document_id
- source_system
- source_uri
- title
- content
- content_type
- source_version
- last_modified
- owner
- language
- classification
- permissions
- additional business metadata
This separation has an important architectural benefit.
Connectors understand the source.
The indexing pipeline understands the canonical document.
If another source is introduced later, we build another connector rather than redesigning the downstream RAG pipeline.
That is one of the foundations of a reusable knowledge architecture.
5. Parse and Normalize Before Chunking
Enterprise content is messy.
Documents can contain:
- headings,
- paragraphs,
- lists,
- tables,
- code blocks,
- images,
- metadata,
- navigation elements,
- repeated headers and footers.
Simply extracting all text and splitting every fixed number of characters usually produces poor retrieval units.
The processing layer should therefore perform:
Raw content → Extraction → Cleaning → Structural parsing → Normalized sections
Where possible, preserve document structure such as:
Document → Section → Subsection → Paragraph / Table / Code Block
This structure later becomes valuable metadata for retrieval, citations and debugging.
6. Chunking Is a Retrieval Decision
Chunking should not be treated merely as preprocessing.
It directly affects retrieval quality.
If chunks are too large, they may contain several unrelated ideas and introduce irrelevant context.
If chunks are too small, they can lose the surrounding information needed to interpret them.
A practical strategy is structure-aware chunking.
Instead of breaking text only by token count, first identify logical boundaries such as headings, paragraphs, tables and code sections. Larger sections can then be divided while maintaining reasonable overlap.
Every chunk should retain metadata connecting it back to the original document.
For example:
- chunk_id
- document_id
- document_version
- section
- source_uri
- chunk_sequence
- content_hash
- ACL metadata
This makes retrieval explainable.
When a result is returned, we should know exactly:
Where did this chunk come from?
7. Version Documents and Chunks
A production knowledge base should assume that documents will continuously change.
Consider:
Document v1
containing:
C1 → C2 → C3 → C4
Later, the source document changes:
Document v2
C1 → C2' → C3 → C4
A naive pipeline may process and index all four chunks again.
A better approach compares the current version with the previous version.
This can be done using normalized content hashes or equivalent change-detection mechanisms.
The system determines:
- unchanged chunks,
- modified chunks,
- new chunks,
- deleted chunks.
Then only affected chunks need expensive downstream processing.
For example:
C1 → reuse
C2' → regenerate embedding
C3 → reuse
C4 → reuse
This pattern becomes especially valuable when the knowledge base contains large volumes of content.
8. Prevent Stale Knowledge from Being Retrieved
Incremental indexing introduces another problem.
Suppose version 2 is being generated while version 1 is still searchable.
If individual chunks are updated independently, the index can temporarily contain a mixture of versions.
That creates a dangerous state:
part old document + part new document
A safer pattern is versioned activation.
For example:
- Keep document version v1 active.
- Process v2.
- Validate that all expected chunks for v2 were successfully processed.
- Write the new chunks.
- Atomically mark v2 as active.
- Mark v1 inactive.
- Remove or asynchronously clean up obsolete chunks.
Retrieval should filter on the active version.
This means a partially processed update does not become production knowledge.
9. Generate Embeddings Only When Necessary
Embeddings are highly useful for semantic retrieval, but embedding generation has cost and latency.
Enterprise systems should therefore avoid regenerating embeddings for unchanged content.
The processing decision becomes:
Has the semantic content changed?
If no:
reuse the existing representation.
If yes:
generate a new embedding and update the index.
Foundry IQ supports vector search and integrated vectorization patterns, including vector encoding during indexing and queries.
Whatever embedding strategy is selected, the operating principle remains the same:
Do not recompute what has not changed.
10. Use Hybrid Retrieval, Not Vector Search Alone
Enterprise search contains many queries where exact terminology matters.
For example:
- error codes,
- product names,
- service identifiers,
- project terminology,
- configuration names,
- abbreviations,
- ticket identifiers.
Vector similarity is strong at understanding semantic meaning.
Keyword search is strong at matching exact terms.
Production retrieval therefore often benefits from combining both.
A typical query path is:
User Query
↓
Keyword Search + Vector Search
↓
Result Fusion
↓
Semantic Ranking / Reranking
↓
Security Filtering
↓
Top Relevant Chunks
↓
Context Assembly
Foundry IQ supports hybrid search in a single request by running full-text and vector queries and combining their results.
This gives the retrieval system both lexical precision and semantic understanding.
11. Treat Authorization as Part of Retrieval
Enterprise RAG must not turn private organizational information into globally searchable information.
If a user cannot access a document in the source system, an AI application should not expose that information simply because it has been indexed.
Permissions must therefore travel with the knowledge.
A document or chunk may include metadata such as:
- allowed users,
- allowed groups,
- tenant or organizational boundaries,
- business classifications,
- source-level security attributes.
At query time:
User Identity → Authorization Context → Retrieval Filter → Authorized Results
Foundry IQ supports patterns for document-level access control and security trimming.
The security principle is simple:
The AI layer must not broaden the user's access to enterprise information.
Authorization is therefore not something that should be bolted onto the application after retrieval.
It belongs inside the retrieval architecture.
12. Handle Deletions Explicitly
Updates are only half of the lifecycle.
What happens when a source document is deleted?
If the ingestion system simply stops seeing it, old indexed chunks can survive indefinitely.
Deletion should therefore generate its own lifecycle event:
Source Delete
→ Deletion Event
→ Locate Active Document Version
→ Deactivate / Remove Chunks
→ Invalidate Related Cache
→ Record Audit Event
The desired result is straightforward:
Deleted enterprise knowledge should no longer be retrievable.
13. Cache Carefully
Caching can improve latency and reduce repeated computation, but knowledge systems have a particular challenge:
knowledge changes.
If retrieved context or generated responses are cached without considering document versions, a perfectly updated search index can still produce stale application responses.
A useful cache key may therefore include information such as:
Query + Security Context + Knowledge Version
When underlying knowledge changes, relevant cached entries should either be invalidated or naturally become unreachable because their version no longer matches the active knowledge state.
Caching and freshness must be designed together.
14. Design for Failure
Production pipelines fail.
A source API can become unavailable.
A parser can fail on an unusual document.
An embedding request can be throttled.
An indexing operation can partially succeed.
This is where queues and asynchronous processing become valuable.
A more resilient ingestion path looks like:
Source Event
→ Queue
→ Processing Worker
→ successful → Index
→ temporary failure → Retry
→ repeated failure → Dead-Letter Queue
Messages should carry correlation identifiers so that an individual source change can be traced across the processing pipeline.
Operations should also be idempotent wherever possible.
Processing the same event twice should not create duplicate knowledge.
15. Measure Freshness
One of the most useful production metrics for an enterprise knowledge platform is something I think of as freshness lag.
If the source changed at:
t_source
and the new version became searchable at:
t_active
then:
Freshness Lag = tactive - tsource
This tells us how stale the AI knowledge could potentially be.
Other useful operational metrics include:
- ingestion success rate,
- queue depth,
- processing latency,
- parser failures,
- embedding failures,
- indexing failures,
- dead-letter queue depth,
- document processing completeness,
- embedding latency,
- search latency,
- stale-version count.
The objective is not simply to know:
“Is the service running?”
The more useful question is:
“How quickly and reliably does enterprise knowledge become safely searchable after it changes?”
16. Measure Retrieval Quality Separately
Operational health does not guarantee retrieval quality.
A pipeline can have 99.9% availability and still return poor context.
The platform should therefore evaluate retrieval separately using metrics or evaluation datasets covering areas such as:
- relevance,
- recall,
- ranking quality,
- groundedness,
- citation correctness,
- authorization correctness.
A useful evaluation set contains representative enterprise questions along with expected relevant documents or passages.
This allows retrieval changes to be evaluated systematically instead of relying only on subjective testing.
17. Observability Should Follow the Entire Knowledge Lifecycle
A production knowledge platform should make it possible to trace:
Source Change
→ Ingestion Event
→ Document Version
→ Chunks
→ Embeddings
→ Index Version
→ Retrieved Context
If an AI application produces a poor answer, the investigation should be able to determine:
- Was the latest source document ingested?
- Which document version was active?
- Which chunks were created?
- Did embedding generation complete?
- Was the index updated?
- Which chunks were retrieved?
- Were security filters applied?
- Was the expected document ranked highly enough?
This is why lineage metadata and correlation identifiers matter.
Without them, debugging RAG quickly becomes guesswork.
18. The Architecture as a Whole
19. What Makes This Architecture Reusable?
The most valuable design choice is separating source-specific behavior from the common knowledge pipeline.
When adding another enterprise source, we should primarily need to implement:
New Source → Connector → Canonical Document
Everything after that can reuse the same:
- normalization,
- chunking,
- metadata,
- versioning,
- change detection,
- embedding,
- indexing,
- security,
- retrieval,
- evaluation,
- monitoring patterns.
The same enterprise knowledge foundation can consequently support multiple applications without recreating ingestion and retrieval architecture for every project.
20. Production Principles
If I had to summarize the architecture into a small set of principles, they would be:
1. Treat knowledge ingestion as a continuous system
Enterprise knowledge changes constantly. RAG cannot be designed as a one-time indexing exercise.
2. Reprocess only what changed
Document and chunk-level change detection reduces unnecessary processing, latency and embedding cost.
3. Version before replacing
Do not expose partially processed document updates.
4. Combine lexical and semantic retrieval
Enterprise queries frequently need both exact terminology and semantic understanding.
5. Preserve authorization
Retrieval should respect the access boundaries of enterprise knowledge.
6. Design for deletion
Removing information is just as important as adding it.
7. Measure freshness
A healthy RAG platform is not merely available. Its knowledge must be current.
8. Evaluate retrieval independently
Good generation cannot compensate for consistently retrieving the wrong evidence.
9. Preserve lineage
Every retrieved chunk should be traceable to its source and version.
10. Build the knowledge layer once, then reuse it
The strongest enterprise RAG architecture is not designed for one chatbot. It becomes reusable infrastructure for future AI applications.
Conclusion
Building a RAG prototype is relatively straightforward.
Building a knowledge foundation that an enterprise can trust is fundamentally a data, retrieval, security and operational engineering problem.
Microsoft Foundry provides the environment for building generative AI applications, while Foundry IQ (Azure AI Search) provides capabilities such as indexing, vector retrieval, hybrid search, semantic ranking and knowledge retrieval.
But technology selection alone does not make a RAG system production-ready.
The architecture around those services matters:
continuous ingestion, incremental updates, versioning, security-aware retrieval, deletion handling, evaluation, freshness monitoring and end-to-end observability.
When these concerns are designed together, RAG stops being a single application feature.
It becomes a reusable enterprise knowledge foundation that can support the next generation of AI applications.
References
- Microsoft Learn — Retrieval augmented generation (RAG) and indexes in Microsoft Foundry https://learn.microsoft.com/en-us/azure/foundry/concepts/retrieval-augmented-generation
- Microsoft Learn — RAG and Generative AI – Foundry IQ (Azure AI Search) https://learn.microsoft.com/en-us/azure/search/retrieval-augmented-generation-overview
- Microsoft Learn — Hybrid Search Overview – Foundry IQ (Azure AI Search) https://learn.microsoft.com/en-us/azure/search/hybrid-search-overview
- Microsoft Learn — Integrated Vectorization Overview – Foundry IQ (Azure AI Search) https://learn.microsoft.com/en-us/azure/search/vector-search-integrated-vectorization
- Microsoft Learn — Document-Level Access Control – Foundry IQ (Azure AI Search) https://learn.microsoft.com/en-us/azure/search/search-document-level-access-overview
- Microsoft Learn — Security Filter Pattern – Foundry IQ (Azure AI Search) https://learn.microsoft.com/en-us/azure/search/search-security-trimming-for-azure-search
No RepliesBe the first to reply