Retrieval-augmented generation finds approved source passages at request time and gives them to a model as evidence. Azure AI Search can combine keyword, vector, filter, and semantic ranking. Good RAG depends more on document quality, chunking, metadata, access trimming, retrieval evaluation, and citations than on a long system prompt.
Lab: 60–90 minutes · Cost: search capacity, index storage, enrichment, embeddings, model tokens, source storage, private networking, and logs can charge.
The ingestion path is separate: source → extract → normalize → chunk → classify/access-label → embed → index → validate → publish.
First create the search service with the required region, tier, replicas/partitions, managed identity, encryption, and private access. Then define the same versioned northstar-chunks index through either data-plane method below. The calling identity needs Search Index Data Contributor at the service scope.
An index commonly stores:
Ways to build
Choose the Azure tool you want to use. The underlying resource stays the same.
Open the search service → Indexes → Add index (JSON). Define chunkId as the key, make tenant/access fields filterable, make content searchable, and configure contentVector with dimensions that exactly match the chosen embedding deployment. Add an HNSW algorithm and vector profile, save, then inspect the index definition before loading synthetic documents.
Azure CLI can create the management-plane service; REST/SDK or a data-plane deployment step defines indexes. Search schema operations require data permissions, not only ARM management access.
Chunk by semantic boundaries such as headings, paragraphs, table sections, or code units. Preserve enough overlap for continuity without duplicating excessive context. Store the document hierarchy and exact citation location. Different content types need different parsers and chunk sizes.
Evaluate chunking with real questions. A fixed number of characters is a baseline, not a design.
Keyword search handles exact names, codes, and rare terms. Vector search handles semantic similarity. Hybrid search combines both and often improves recall. Semantic ranking can rerank candidates and produce captions where supported. Filter first by tenant, authorization, language, date, or document type as appropriate.
Do not retrieve a large topK and hope the model sorts it out. Measure recall@k, precision, ranking quality, answer groundedness, citation correctness, latency, and cost.
The application must know the authenticated user's tenant and groups. Put allowed principals or policy attributes in indexed metadata, then apply a server-built filter. Never let the user supply the authorization filter. Consider index-per-tenant, shared index with filters, or hybrid isolation from data sensitivity, scale, operations, and cost.
Security trimming must also apply to caches, logs, evaluation datasets, and citations. A citation link should not reveal an inaccessible document.
Azure AI Search can integrate supported chunking and vectorization skills in an indexer pipeline. It accelerates setup, but you still own model choice, dimensions, failure handling, reindexing, source deletion, throughput, cost, and quality. Custom ingestion gives more control for complex parsers and governance.
Search is a serving projection, not the only copy of source content.
Declare the search service, private endpoint/DNS, identity, RBAC, diagnostics, alerts, and capacity in Bicep/Terraform. Define index schema through a versioned data-plane deployment step. Give the indexer read access only to approved source containers and the app search-query access only.