SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
Implement information extraction solutions

AI-103: Build Retrieval and Grounding Pipelines with Azure AI Search

20 min readAI-103 · Implement information extraction solutionsUpdated

A retrieval and grounding pipeline is the ingestion side of RAG: it pulls documents, images, audio and video into an Azure AI Search index, enriches and chunks them with skills, embeds the chunks, and exposes the index to agents and workflows as a grounding tool. This lesson covers AI-103 task 5.1 — indexers with change and deletion detection, OCR and layout-aware extraction with the Azure Content Understanding skill, index projections, the embedding skill, built-in and custom skills, image, audio and video ingestion, vector, hybrid and semantic configuration, and connecting the result to Foundry agents through the Azure AI Search tool or a Foundry IQ knowledge base's MCP endpoint.

What you’ll learn
  • Configure an indexer with a schedule, change detection, deletion detection and the right field or output field mappings
  • Build an OCR flow that extracts images, reads their text and merges it into the content that gets chunked and embedded
  • Choose between the Azure Content Understanding, Document Layout and Document Extraction skills, and configure file_data and locationMetadata
  • Write chunks to an index with index projections and an embedding skill whose dimensions, input size and identity are correct
  • Enrich text with built-in skills and custom Web API skills, and attach a billable Foundry resource without keys
  • Ingest images, audio and video by choosing verbalization, multimodal embeddings or Content Understanding search analyzers
  • Configure vector fields, filters, hybrid and semantic queries, and connect the index to agents through the Azure AI Search tool or a knowledge base MCP endpoint

How does an indexer pull documents into an Azure AI Search index?

An indexer is the pull-based way to ingest content: it connects to a data source (Blob Storage, ADLS Gen2, Azure SQL, Cosmos DB and others), cracks each file, optionally runs a skillset of enrichment skills, and writes the results to an index. The alternative is the push model — your own code (a Function, a Logic App, an app) calls the documents API — which works with any source but means writing and hosting that upload code. When the source is supported and the requirement is "no upload code", use an indexer.

Schedules and change detection

Give the indexer a schedule (for example hourly) and it re-runs on its own. For Azure Storage, change detection is built in: the indexer compares each blob's LastModified timestamp and processes only new or edited files. Database sources need a change detection policy, such as a high-water-mark column.

Deletion detection

A deleted file does not leave the index by itself. A deletion detection policy on the data source tells the indexer how to recognise deletions:

  • Native blob soft delete — enable blob soft delete on the storage account; when the indexer next processes a blob that is in the soft-deleted state, it removes the matching search document. Nothing happens between runs, so set the soft delete retention period well above the indexer interval, or the blob may be purged before the indexer sees it. This policy isn't supported when blob versioning is enabled.
  • Soft delete column — a metadata property (such as IsDeleted) that you set to a marker value before deleting the file. It is the alternative for sources that can't use native soft delete, and it relies on everyone flagging files first.

The policy must exist from the first indexer run. Files deleted before a policy existed leave orphaned documents that resetting the indexer does not clean up — a reset only reprocesses files that still exist. Microsoft's guidance in that case is a new index and indexer with the policy configured from the start.

Field mappings and output field mappings

An indexer has two kinds of mappings, and they run at different times:

fieldMappingsoutputFieldMappings
RunsDuring document cracking, before any skillAfter the skillset has run
SourceFields that exist in the data source (for example metadata_storage_path)Nodes in the enriched document (for example /document/organizations)
Typical useRename a source field, apply a mapping functionSend skill outputs to index fields

A skill output placed in fieldMappings is never found, so the field silently stays empty. Field mappings can also apply mapping functions. The classic case is the document key: keys may contain only letters, digits, underscores, dashes and equal signs, so a raw blob URL is rejected. Mapping metadata_storage_path to the key with base64Encode gives a stable, unique, valid key per file. Pick the function by its output: a key needs one that emits only allowed characters, and an analyzer only affects how a searchable field is tokenized, never which characters a key may hold.

How does a RAG ingestion flow handle scans, embedded images and OCR?

Text that exists only as pixels — a scanned TIFF, a photographed form, a picture inside a PDF — needs image extraction plus the OCR skill. Document cracking only pulls out text that is stored as text, so a scan produces an empty content field.

  1. Extract the images. Set the indexer's imageAction configuration: none (the default) extracts no images; generateNormalizedImages extracts embedded images and image files; generateNormalizedImagePerPage renders each PDF page as an image (other file types behave like generateNormalizedImages). The results land in /document/normalized_images/*, each with metadata such as its contentOffset in the text.
  2. Read the text. The OCR skill runs over /document/normalized_images/* and outputs text (printed and handwritten) and layoutText (the same text with bounding-box positions).
  3. Merge it back. OCR text is stored per image. You can map it to its own field (keyword search then finds it), but chunking and embedding skills read /document/content. The Text Merge skill takes the content, the OCR text and each image's contentOffset and produces one merged string with the image text inserted where the image was. Chunk and embed that output.

Two near-twins to keep apart: the Image Analysis skill describes what a picture shows (tags, captions, objects) rather than reading its text, and parsingMode: text reads a blob as plain text — neither helps with a scan. dataToExtract controls whether cracking extracts content and metadata or metadata only. Output field mappings can't fix a merge problem either, because they run after every skill has finished.

Which skill should extract layout and chunk documents?

For a new skillset that needs structure — headings, tables, figures, page numbers — use the Azure Content Understanding skill. It extracts text and images, outputs tables and figures as Markdown, treats a table that continues across pages as one unit, and chunks the content itself (chunks may span pages), so no separate Text Split skill is needed. Microsoft keeps the Document Layout skill for existing pipelines but recommends Content Understanding for new ones.

Content Understanding skillDocument Layout skillDocument Extraction + Text Split
TablesMarkdown; cross-page tables kept wholePlain textNo table handling
ChunkingBuilt in; chunks can span pagesText chunks stay within a page's boundsNeeds the Text Split skill
Page location per chunkWith locationMetadata: pageNumberFrom / pageNumberToWith locationMetadata, per pageNo
StatusRecommended for new skillsetsSupported for existing pipelinesBasic text extraction

The skill's extractionOptions decide what comes back: images extracts figures (to display beside answers or to verbalize), and locationMetadata adds page information to each chunk, which is what lets an agent cite a page range. Leave out locationMetadata and there is nothing to cite.

Both layout skills analyse the original file, not cracked text. For blob sources the file reaches them through the /document/file_data node, which exists only when the indexer's configuration sets allowSkillsetToReadFileData to true — otherwise the skill reports its file_data input as missing. Content Understanding handles documents and images; it does not accept audio or video files (see the audio and video section below).

How do index projections write chunks as separate search documents?

Index projections turn one source document into many search documents — one per chunk — which is what a RAG index normally needs. They are defined in the skillset: each projection has a selector naming the target index, the sourceContext to iterate (for example /document/pages/*), the parentKeyFieldName, and mappings from enriched nodes to chunk fields.

Rules that break pipelines when ignored

  • Don't map the parent key. The field named by parentKeyFieldName is filled by the projection with a generated key the indexer uses to find, replace and delete a document's chunks when the source changes. Map every child field except the document key and the parent key; mapping the parent key yourself disrupts change tracking, so edited files leave their old chunks behind.
  • Index schema. The document key must be an Edm.String field using the keyword analyzer; the parent field must be an Edm.String that is filterable and is not the key (many chunks share one parent, so it isn't unique). Nothing else is required — no sortable chunk field, no retrievable vector.
  • projectionMode. The default, includeIndexingParentDocuments, also writes one document per source file whose chunk and vector fields are empty — a batch of 12 files split into 300 chunks becomes 312 documents, and the empty ones can reach the model as useless context. skipIndexingParentDocuments writes only the chunks, which Microsoft recommends when chunks are what you search.

parsingMode: jsonArray is unrelated: it splits JSON arrays that already exist in the source files, not chunks created by a skill.

How do you configure the Azure OpenAI Embedding skill?

The Azure OpenAI Embedding skill calls an embedding deployment during indexing and writes a vector for each input. Three settings decide whether it works:

  • Dimensions must match the field. text-embedding-3-large supports 1–3,072 dimensions and text-embedding-3-small 1–1,536, chosen with the skill's dimensions property; omit it and you get the model's maximum. text-embedding-ada-002 is fixed at 1,536. The vector field must declare the same number, and an existing field's dimensions can't be changed — shrinking vectors means a new field (and matching mapping or projection).
  • Input size. The skill accepts roughly 8,000 tokens of input whatever the model. Long documents must be chunked first (Text Split or a layout skill) and embedded in the chunk context, such as /document/pages/*, which also gives the one-vector-per-passage shape retrieval needs. The limit applies per input, so the fix is always smaller inputs, not a different setting on the skill or the indexer.
  • Authentication. With an apiKey the skill uses the key. With both apiKey and authIdentity empty, it uses the search service's system-assigned managed identity. Set authIdentity to a user-assigned identity's resource ID to use that identity instead. Setting both a key and an identity is rejected. The identity needs Cognitive Services OpenAI User on the Azure OpenAI resource — the least-privilege role; a 403 usually means the identity actually in use doesn't hold it.

To embed queries the same way at search time, add a matching vectorizer to the vector profile (integrated vectorization). Choosing integrated vectorization and a chunking strategy is covered in the lesson on choosing Foundry services (task 1.1).

Which built-in skills enrich text, and how is enrichment billed?

Built-in text skills add or transform text during indexing. The ones RAG pipelines use most:

SkillWhat it producesTypical RAG use
PII DetectionDetected personal data and, with a masking mode, maskedTextIndex maskedText so names and phone numbers are never stored, while the rest stays readable
Entity RecognitionLists of people, organizations, locations and moreFilterable or facetable entity fields
Language DetectionA language codeRouting or filtering by language
Key Phrase ExtractionKey phrasesExtra searchable keywords — not a replacement for the text
Text TranslationTranslated textNormalising a multilingual corpus into one language before chunking

Text Translation settings: defaultToLanguageCode (the target, such as en) is required. Leave fromLanguageCode and defaultFromLanguageCode unset and the skill uses the Translator's automatic language detection — the right setting when nobody knows each file's language. suggestedFrom is only a fallback when detection fails. The source setting describes the input and the target describes the output you want, so fix only the target and let detection handle the source.

Attaching a billable Foundry resource

Skills that call Foundry Tools (OCR, Entity Recognition, PII Detection, translation and the like) run free for only 20 documents per indexer per day. After that, enrichment stops partway through the day and the indexer logs errors; tolerating failures (maxFailedItems) only leaves documents unenriched. The fix is to attach a Foundry resource to the skillset:

  • Keyless (AIServicesByIdentity) — the search service's managed identity calls the resource, which needs Cognitive Services User for that identity. No keys, and no same-region requirement.
  • Key-based (AIServicesByKey, or the classic CognitiveServicesByKey, which calls a regional endpoint and expects the resource in the search service's region).

When should you write a Custom Web API skill?

Use the Custom Web API skill when enrichment needs logic no built-in skill provides — your own normalization rules, a partner API, a proprietary model. It sends batches of enrichment-tree values to an HTTPS endpoint you host (often Azure Functions) and adds the returned outputs back to the tree, where later skills such as the embedding skill can read them. Other skills only look similar: the GenAI Prompt skill calls a deployed chat model, the Shaper skill restructures existing values, and the Conditional skill chooses between existing values.

The contract

The request body is {"values": [...]}; each record has a unique recordId and a data object. The response must be a values array with one entry per record, each carrying its recordId, a data object with the outputs, and errors and warnings (which may be null). Records are matched by recordId, not order — a record returned without its ID is invalid and is not enriched, even though the call returned HTTP 200. The skill expects a synchronous response; it doesn't poll.

Throughput settings

SettingDefaultLimit / note
batchSize1,000 records per callLower it so one call's work fits in the timeout
timeoutPT30SMaximum PT230S
degreeOfParallelism5 concurrent callsMaximum 10; keep within what the endpoint or partner allows

So an endpoint that needs a few seconds per record (say 2.5 seconds) times out at the defaults — a full batch would take far longer than 30 seconds. Size batchSize so that per-record time × records per batch fits under a raised timeout. httpMethod (POST or PUT) only changes the verb. For keyless calls, the skill can authenticate to a Microsoft Entra–protected endpoint with the search service's managed identity by setting authResourceId.

How do you make images, audio and video searchable for RAG?

Images reach a RAG index by one of two paths, and the requirement decides which:

Image verbalizationDirect multimodal embeddings
HowThe GenAI Prompt skill asks a multimodal chat model to describe each extracted image; the description is embedded as textThe Azure Vision multimodal embeddings skill (or the AML skill with a Foundry catalog multimodal model) embeds images and text into one vector space
Good forDiagrams, flowcharts and charts the model must explain and citeVisual similarity — "find products that look like this photo"
Image as the queryNo — text embedding models can't vectorize an imageYes, through the matching multimodal vectorizer
CostAn LLM call per image; slower indexingNo LLM at indexing time

OCR or Image Analysis on a diagram keeps labels or tags but loses arrows and sequence. The general rule: a query image can only be compared with indexed content if a model that embeds images produced both vectors — any text-only stage in the path rules out searching by photo.

GenAI Prompt skill limits: it calls chat completions endpoints only (Responses API endpoints aren't supported), and its request timeout is fixed at 30 seconds with no property to raise. Reasoning models such as o3 can exceed that during bulk indexing, so use a fast multimodal non-reasoning model; moving the call into a Custom Web API skill would allow up to 230 seconds, but means hosting code.

Audio and video

Indexers and skills don't transcribe or segment media. Use Azure Content Understanding's RAG analyzers first, then chunk, embed and push the output into the index: prebuilt-videoSearch transcribes speech and splits a video into described segments with start and end times (keep them so answers can point to the segment), and prebuilt-audioSearch transcribes recordings and adds a short summary. prebuilt-documentSearch is the document equivalent, and prebuilt-callCenter is call analytics, not RAG content. Building custom analyzers and field extraction is covered in the Content Understanding lesson (task 5.2).

How do you configure vector, hybrid and semantic search for grounding?

Configure grounding search with a searchable Collection(Edm.Single) vector field whose dimensions match the embeddings and whose vector profile names an algorithm, add filterable nonvector fields for any filter, and then layer hybrid (text plus vector) or semantic ranking on top at query time.

Vector fields and algorithms

  • A vector field is Collection(Edm.Single) (or a narrower type), searchable, with dimensions and a vector profile naming an algorithm and, optionally, a vectorizer. HNSW is approximate and fast at scale; exhaustive KNN compares every vector — exact but costly, for small indexes or ground-truth checks. A query can also set exhaustive: true to brute-force an HNSW field. The algorithm never changes how many dimensions a field accepts.
  • Vector fields can't be filterable. To restrict a vector query (one department, one tenant), add a filterable nonvector field and pass a filter. A scoring profile only reorders results; it doesn't exclude anything.
  • stored and retrievable. stored: false removes the source copy of each vector to save storage. It can only be set when the index is created — a vector field added to an existing index can't set it to false — and it can't be reversed, and retrievable must stay false while it is. Without the stored copy, a merge or mergeOrUpload that omits the vector silently drops it, and the document stops matching vector queries. Either send the full vector with every partial update, or create and load a new vector field that keeps stored: true.

Filter modes

vectorFilterModeBehaviourRisk
preFilter (default)Applies the filter while traversing the graphMore CPU for selective filters, but returns k matches whenever that many exist
postFilterEach shard finds its unfiltered top k, then filtersA selective filter (one tenant's 1%) can leave few or no results; raising k only softens it
strictPostFilter (preview)Filters the global top k after the searchLoses the most results with selective filters

Hybrid and semantic

A hybrid query sends search text and a vectorQueries entry in one request; the service runs both and merges them with Reciprocal Rank Fusion, so exact terms (part numbers, codes) and meaning both count. Semantic ranking needs a semantic configuration on the index (a title field, content fields and keyword fields in priority order) and reranks the top results with queryType: semantic; it works with or without vectors. When to choose each method is taught in task 1.1, and writing the query in code in task 2.1.

How do you connect a retrieval pipeline to agents and workflows?

An index or knowledge base becomes a grounding source for agents through a tool, and agents in turn are the steps a Foundry workflow orchestrates. A workflow therefore reaches the retrieval pipeline through the agents it calls, so configure grounding once on the agent's tool and every workflow that uses that agent inherits it. There are two connection patterns.

The Azure AI Search tool (one index)

  • A project connection to the search service plus the tool definition with an index_name. Each tool targets exactly one index; a comma-separated list isn't supported.
  • query_type is one of simple, semantic, vector, vector_simple_hybrid or vector_semantic_hybrid (the default). Vector and hybrid types need vector fields; for an index with only text fields and a semantic configuration, semantic is the best available ranking.
  • Private search services: only a standard agent setup with virtual network injection reaches a search service with public access disabled (a basic setup can't). In that configuration the connection must use Microsoft Entra ID with the project managed identity — API keys aren't supported — and that identity needs Search Index Data Contributor and Search Service Contributor on the search service.

A Foundry IQ knowledge base over MCP (several sources)

  • A knowledge base references one or more knowledge sources, including existing indexes, without copying content. It exposes an MCP endpoint (…/knowledgebases/<name>/mcp) whose retrieval tool is knowledge_base_retrieve, so one agent tool can ground answers in several indexes — and any MCP-capable client or workflow step can call it.
  • The agent's MCP tool references a RemoteTool project connection with ProjectManagedIdentity authentication (no stored keys). CognitiveSearch connections are for the Azure AI Search tool, CustomKeys store secrets, and AzureOpenAI is for models.
  • Roles: the project's managed identity needs Search Index Data Reader on the search service (Contributor only if it writes) — without it every call returns 403. Separately, if the knowledge base uses an LLM for query planning or answer synthesis, the search service's identity needs Cognitive Services User on the Foundry resource.
  • Per-user results: the managed identity authorizes the call but says nothing about which user is asking, so permission-aware sources return unfiltered results. Add an x-ms-query-source-authorization header to the MCP tool whose value is a {{placeholder}} bound to a structured input, and have the app pass the signed-in user's Azure AI Search token in structured_inputs on every request. Permission trimming needs the user's own token at query time; anything fixed in the agent's configuration identifies the agent, not the person asking.

Filters, citations and file search inside agents are covered in the agents lesson (task 2.2).

Tip. Expect scenario items about an ingestion or retrieval pipeline that isn't behaving — an empty content field, stale or orphaned documents, missing chunks, a 403, a timeout — or a new requirement such as citing page ranges, searching by photo, or answering from videos. The deciding detail is usually a constraint: no upload or custom code, no API keys, least privilege, the index must not be rebuilt, slower indexing is acceptable, or a partner's concurrency limit. Several items show a short JSON or Python fragment (a mapping, a projection selector, a custom skill response) and ask what to change, and some ask you to select two changes that together fix the problem.

Key takeaways
  • Supported source and no upload code means an indexer on a schedule; blob change detection uses LastModified automatically.
  • Native blob soft delete detection needs versioning off and must exist from the first run; deletions take effect on the next indexer run.
  • fieldMappings read source fields before skills run; outputFieldMappings send skill outputs to the index. Use base64Encode to turn a path into a valid key.
  • Scans need imageAction plus the OCR skill, and the Text Merge skill is what puts image text into the content that gets chunked and embedded.
  • For new layout-aware skillsets use the Azure Content Understanding skill: Markdown tables, cross-page chunks, locationMetadata page ranges, and allowSkillsetToReadFileData for file_data.
  • Index projections: never map the parent key, use a keyword-analyzed string key and a filterable string parent field, and skipIndexingParentDocuments for chunk-only indexes.
  • Embedding skill dimensions must equal the vector field's; chunk anything over about 8,000 tokens; empty apiKey and authIdentity means the system-assigned identity.
  • Built-in skills are free for 20 documents per indexer per day; a keyless AIServicesByIdentity attachment removes the limit with no region requirement.
  • Custom Web API responses must echo every recordId; tune batchSize, timeout (max PT230S) and degreeOfParallelism (max 10) together.
  • Verbalize diagrams that must be explained, embed images directly for look-alike search; use Content Understanding audioSearch and videoSearch analyzers for media.
  • One Azure AI Search tool targets one index; a knowledge base over several indexes connects through a RemoteTool MCP connection, with a per-request user token for permission trimming.

Frequently asked questions

How do I make Azure AI Search remove documents when the source blobs are deleted?

Add a deletion detection policy to the blob data source before the indexer's first run. With native blob soft delete detection, enable blob soft delete on the storage account (and keep blob versioning off), set the retention period longer than the indexer interval, and the indexer removes each document the next time it processes the soft-deleted blob. Blobs deleted before the policy existed aren't cleaned up by a reset; Microsoft recommends a new index and indexer with the policy from the start.

Why is text from images missing from my vector search results in Azure AI Search?

The OCR skill stores the text it reads per image under /document/normalized_images/*, while chunking and embedding skills read /document/content. Add the Text Merge skill to combine the content with the OCR text at each image's contentOffset, then chunk and embed the merged output. Output field mappings can't fix it, because they run after all skills have finished.

Should I use the Azure Content Understanding skill or the Document Layout skill?

Use the Azure Content Understanding skill for new skillsets. It outputs tables as Markdown, keeps tables that span pages together, chunks the content itself with chunks that can cross page breaks, and adds pageNumberFrom and pageNumberTo when locationMetadata is requested. The Document Layout skill remains supported for existing pipelines; its tables are plain text and its text chunks stay within a page. Both need allowSkillsetToReadFileData set to true for blob sources.

What do index projections do in Azure AI Search?

Index projections write each chunk produced by a skillset as its own search document in a target index, linked to its source by a parent key that the indexer generates and maintains. The index needs an Edm.String key with the keyword analyzer and a filterable Edm.String parent field that isn't the key. Don't map the parent key yourself, and set projectionMode to skipIndexingParentDocuments if you don't want an empty parent document per file.

How does the Azure OpenAI Embedding skill authenticate without an API key?

Leave both apiKey and authIdentity empty and the skill uses the search service's system-assigned managed identity; set authIdentity to a user-assigned identity's resource ID to use that identity instead. Whichever identity is used needs the Cognitive Services OpenAI User role on the Azure OpenAI resource. A skill that sets both apiKey and authIdentity is rejected.

Why does my skillset stop enriching documents partway through the day?

Built-in skills that call Foundry Tools, such as OCR and Entity Recognition, run free for only 20 documents per indexer per day. Attach a billable Foundry resource to the skillset; a keyless AIServicesByIdentity attachment uses the search service's managed identity (with Cognitive Services User on the resource), stores no keys and has no same-region requirement.

How do I index audio and video for a RAG agent?

Azure AI Search indexers don't transcribe or segment media, so analyze the files with Azure Content Understanding first: prebuilt-audioSearch transcribes recordings and adds a summary, and prebuilt-videoSearch adds segment descriptions with start and end times. Chunk and embed that output and push it into the index, keeping the time ranges so answers can point to the right segment.

How can one Foundry agent search several Azure AI Search indexes with a single tool?

The Azure AI Search tool targets only one index. Create a Foundry IQ knowledge base whose knowledge sources reference the existing indexes, then give the agent an MCP tool that calls the knowledge base's MCP endpoint (its knowledge_base_retrieve tool) through a RemoteTool project connection using the project's managed identity. That identity needs Search Index Data Reader on the search service.

Source

This lesson covers the "Implement information extraction solutions" domain of the official AI-103 exam guide. Vendors revise their guides — check the source for the current version.

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?