RAG and Foundry IQ

Grounding agents in your own data: the RAG pipeline, agentic retrieval, and what a Foundry IQ knowledge base actually is.

  • Gen AI apps & agents
  • 22 minutes
  • High priority

After this lesson you can

  • Walk through the RAG pipeline and say what happens at query time
  • Explain what Foundry IQ provides beyond a plain search index
  • Diagnose a grounding failure and pick the right fix

Why RAG exists

A model knows only what was in its training data, up to its cutoff. It cannot know your policies, your contracts, or what changed last week - and it will confidently make something up rather than say so.

Know this: The fix in one line

Retrieve the relevant passages from your own content at query time, put them in the prompt as grounding data, and have the model answer from them - with citations back to the source.

The pipeline

Try itClick through each stage to see what happens to a real question.

User asks How many days of holiday do I get after five years?

Ingest Ahead of time

Source documents are connected. In Foundry IQ these are knowledge sources: Blob Storage, SharePoint, OneLake, public web.

handbook.pdf, benefits-2026.docx, policy-leave.md and 11,997 more

The first three stages happen ahead of time. Only the last three run when a user asks something - which is why a question about "what happens when the user asks" always starts at retrieval.

Everything up to indexing happens ahead of time. Retrieval and generation happen per query. If a question asks what happens "when the user asks a question", the answer starts at retrieval.

StageWhat it doesWhy it matters
IngestPull in source documentsDetermines what the assistant can ever know
ChunkSplit into focused passagesA whole handbook as one vector represents nothing precisely
Embed & indexVectorise passages and store themEnables semantic matching, not just keywords
RetrieveFind the passages closest to the queryThe quality ceiling for the whole system
AugmentInsert those passages into the promptThis is the "grounding data"
GenerateModel answers from the context, with citationsTraceable, checkable output

Check your understanding

Gen AI apps & agents

Why is chunking necessary when building a knowledge base for RAG?

Check your understanding

Gen AI apps & agents

What is a vector index used for in a RAG solution?

Agentic retrieval

Changed: Classic RAG is no longer the only pattern

Classic RAG issues one query per question. Agentic retrieval uses a model to plan: it reads conversation history for context, decomposes a complex question into several focused subqueries, runs them in parallel, applies semantic ranking, and returns structured grounding data with citations and execution metadata.

Choose…When
Agentic retrievalThe client is an agent or chatbot; queries are complex or conversational; you want maximum relevance and structured, cited responses; you are building a new RAG solution
Classic RAGYou need generally available features only, want simplicity and speed, or already have orchestration code and want fine-grained control

Check your understanding

Gen AI apps & agents Hard

How does agentic retrieval differ from classic RAG?

Foundry IQ

Foundry IQ is the managed knowledge layer that gives an agent a single endpoint to your organisation's data. It is built on Azure AI Search, but you configure it in Foundry rather than managing indexes directly.

Know this: The vocabulary

A knowledge base = one or more knowledge sources (Azure Blob Storage, SharePoint, OneLake, public web) plus retrieval parameters. Multiple agents can share one knowledge base.

Knowledge source kindHow it worksExamples
IndexedContent is ingested into a search index; chunking, vectorising and permission sync are automaticAzure Blob Storage, OneLake, SharePoint, an existing search index
RemoteNothing is copied; the source is queried live at retrieval timeSharePoint through the Copilot Retrieval API, the web through Grounding with Bing
  • Automates chunking, embedding generation and metadata extraction; indexers can run on a schedule for incremental refresh.
  • Issues keyword, vector or hybrid queries across indexed and remote sources.
  • Uses agentic retrieval to plan queries, select sources, run parallel searches and aggregate results.
  • Returns extractive data with citations so answers trace back to source documents.
  • Synchronises access control lists, honours Microsoft Purview sensitivity labels, and enforces permissions at query time.
  • Can run queries under the caller's Microsoft Entra identity for end-to-end permission enforcement.
  • Sets a retrieval reasoning effort: minimal merges results with no language model, while low and medium use a model to plan subqueries - medium adds iterative search.

Release status is mixed, so read questions carefully: extractive retrieval at minimal effort is generally available, while model-based query planning and answer synthesis are still in preview. For agents, Microsoft recommends returning extractive data and letting the agent write the answer.

Exam trap: The permission-aware angle

Foundry IQ is the standard answer to "the agent must never show restricted content to an unauthorised user". That is a privacy and security requirement - content filters, which block harmful categories, have no concept of who may see which document.

Check your understanding

Gen AI apps & agents

What is Foundry IQ?

Check your understanding

Gen AI apps & agents

Which statement about a Foundry IQ knowledge base is correct?

When grounding fails

A grounded assistant that answers something unsupported has failed in one of two places. Diagnose before you change anything.

SymptomLikely causeFix
Answer ignores the retrieved passagesThe prompt did not constrain the modelSystem message: answer only from context, say "I don't know" otherwise
Retrieved passages were irrelevantChunking, embedding or search configurationRevisit chunk size, embedding model, and keyword vs. semantic vs. hybrid search
Answers are slowLarge index, too many passagesFiltering, reranking, tighter retrieval
Token budget exceededToo much retrieved content in the promptFilter, rank or summarise passages before augmenting
Sensitive content leakedNo permission enforcement on retrievalPermission-aware retrieval (Foundry IQ) - not a content filter

Check your understanding

Gen AI apps & agents Hard

A grounded assistant returns an answer that is not supported by any of the retrieved passages.

Which two responses address the problem most directly?

Choose 2. Each correct answer is part of the solution. Each correct selection is worth one point.

Choose 2, then check.