How microsoft/azure-ai-search-foundry-iq-live-knowledge-sources works
Purpose and Entry Points
This accelerator deploys, exercises, and inspects Foundry IQ Knowledge Bases that compose Azure AI Search MCP Server and Fabric Ontology knowledge sources. It supports offline replay, MCP-only Azure deployments, BYO Fabric, and greenfield Fabric.
Primary lifecycle entry points are liveks and liveks.ps1; Python CLI implementation is in src/liveks/cli.py and runtime orchestration in src/liveks/runtime.py.
Configuration and Profile Boundary
A versioned YAML ledger is the canonical deployment input. The CLI validates it, resolves secret environment references, derives names, projects settings into azd, and records redacted deployment state. Profiles define the supported deployment modes and prevent incompatible Fabric ownership configurations.
Paths: config/schema.yaml, profiles/mcp-only.yaml, profiles/byo-fabric.yaml, src/liveks/config.py.
Lifecycle Planner and Safety Controls
The CLI implements bootstrap/init, doctor, plan, up, verify, e2e, and down flows. Planning is intentionally non-mutating; provisioning requires explicit confirmation. Cleanup is ownership-aware: BYO Fabric is retained, while generated full-profile Fabric assets can be removed only when configuration and deployment lock agree.
Paths: src/liveks/runtime.py, src/liveks/diagnostics.py, scripts/deploy.sh, scripts/destroy.sh.
Knowledge Source and Knowledge Base Construction
Python factory modules construct preview Azure AI Search payloads for:
1. remote HTTPS MCP Server knowledge sources,
2. Fabric Ontology knowledge sources,
3. a Foundry IQ Knowledge Base that routes retrieval to one or both sources.
The resulting retrieve response is the key product contract: one answer plus activity, references, and sourceData evidence. API behavior is tied to Azure AI Search preview APIs.
Paths: src/ks_factory/mcp_server.py, src/ks_factory/fabric_ontology.py, src/ks_factory/knowledge_base.py.
Azure and Fabric Provisioning
Azure Developer CLI coordinates infrastructure deployment. Bicep provisions Azure AI Search, Azure OpenAI, Storage, and hosting resources. Post-provision scripts create/configure knowledge-source resources and deployment artifacts. Separate Fabric automation can create capacity, workspace, Lakehouse, ontology, and GraphModel for the full profile.
Paths: azure.yaml, infra/main.bicep, scripts/postprovision.py, scripts/fabric-provision.py.
Retrieval UI and Managed API Boundary
The optional demo is an Azure Static Web Apps frontend backed by managed Node.js Azure Functions. Browser code calls API endpoints for MCP, Fabric, combined retrieval, status, and deployment summary; sensitive Search/OpenAI credentials remain server-side. Offline mode replays checked-in response data rather than asserting live retrieval.
Paths: static-app/src/main.js, static-app/api/retrieve-combined/index.js, static-app/api/shared/search.js, static-app/api/shared/offline.js.
External Services and Domain Inputs
Material dependencies are Azure AI Search/Foundry IQ, Azure OpenAI, Azure Static Web Apps/Functions, Azure Storage, Azure Developer CLI, and optionally Microsoft Fabric. MCP retrieval requires a remote HTTPS MCP server; the sample uses Microsoft Learn. Fabric retrieval requires an end-user search token. Airline Operations CSVs and ontology contract are synthetic demonstration inputs, not a required runtime data plane.
Paths: samples/ontology/airline-ops/ontology-contract.yaml, samples/data/airline-ops/, samples/responses/combined-airline-ops-retrieve.sample.json.
Main entry points: runtime.py Runtime orchestrator · mcp_server.py Knowledge source factories · index.js Managed retrieval API · config.py Config ledger
Components 21
Lifecycle Control
- liveks CLI · Lifecycle entry point.
src/liveks/cli.py - Runtime orchestrator · Runs init, plan, up, verify, e2e, and down flows.
src/liveks/runtime.py - Config ledger · Validated deployment input with secret references and derived names.
src/liveks/config.py - Config schema
config/schema.yaml - Deployment profiles · Constrain MCP-only and BYO Fabric ownership modes.
profiles/mcp-only.yaml - Doctor and safety checks · Supports non-mutating planning and ownership-aware cleanup.
src/liveks/runtime.py
Knowledge Construction
- Knowledge source factories · Builds MCP and Fabric Ontology preview payloads.
src/ks_factory/mcp_server.py - Knowledge Base factory · Builds Foundry IQ retrieval routing payloads.
src/ks_factory/knowledge_base.py
Provisioning
- Azure Developer CLI
azure.yaml - Azure infrastructure · Provisions Search, OpenAI, Storage, and hosting.
infra/main.bicep - Post-provision setup · Creates knowledge-source resources and deployment artifacts.
scripts/postprovision.py - Fabric provisioner · Creates full-profile Fabric capacity, workspace, Lakehouse, ontology, and GraphModel.
scripts/fabric-provision.py
Retrieval Demo
- Managed retrieval API · Keeps Search and OpenAI credentials server-side.
static-app/api/retrieve-combined/index.js - Retrieval UI · Calls MCP, Fabric, combined retrieval, status, and summary endpoints.
static-app/src/main.js - Offline replay · Returns checked-in retrieval responses without live assertions.
static-app/api/shared/offline.js
Other components
- Azure AI Search / Foundry IQ · Hosts preview knowledge sources and Knowledge Bases.
- Azure OpenAI
- Microsoft Fabric · Provides ontology retrieval for BYO or full profiles.
- Remote HTTPS MCP server · Microsoft Learn is the sample source.
- Sample retrieve response · Defines answer, activity, references, and sourceData evidence.
samples/responses/combined-airline-ops-retrieve.sample.json - Airline ontology input · Demonstration ontology contract and CSV inputs.
samples/ontology/airline-ops/ontology-contract.yaml
Connections 24
- liveks CLI → Runtime orchestrator: invokes
- Runtime orchestrator → Config ledger: loads and resolves
- Config ledger → Config schema: validates against
- Config ledger → Deployment profiles: selects
- Runtime orchestrator → Doctor and safety checks: runs
- Runtime orchestrator → Azure Developer CLI: projects settings and deploys
- Azure Developer CLI → Azure infrastructure: deploys
- Azure infrastructure → Azure AI Search / Foundry IQ: provisions
- Azure infrastructure → Azure OpenAI: provisions
- Azure Developer CLI → Post-provision setup: runs
- Post-provision setup → Knowledge source factories: uses payloads from
- Post-provision setup → Knowledge Base factory: uses payload from
- Knowledge source factories → Azure AI Search / Foundry IQ: creates knowledge sources
- Knowledge Base factory → Azure AI Search / Foundry IQ: creates Knowledge Base
- Knowledge source factories → Remote HTTPS MCP server: configures remote source
- Knowledge source factories → Microsoft Fabric: configures ontology source
- Deployment profiles → Fabric provisioner: full profile enables
- Fabric provisioner → Microsoft Fabric: creates Fabric assets
- Airline ontology input → Fabric provisioner: supplies demo ontology
- Retrieval UI → Managed retrieval API: calls retrieval endpoints
- Managed retrieval API → Azure AI Search / Foundry IQ: executes retrieval
- Managed retrieval API → Azure OpenAI: uses server-side credentials
- Managed retrieval API → Offline replay: uses in offline mode
- Offline replay → Sample retrieve response: replays