SQL-AI-samples: Azure's Sample Collection for AI on Azure SQL Database
Samples using AI and Azure SQL DB
At a glance
- What is it?
- A Microsoft-maintained repository of notebooks, T-SQL scripts and end-to-end demos that connect Azure SQL Database to OpenAI, Cognitive Search and LangChain. It is a learning catalogue, not a library you install.
- Who is it for?
- Adopt this repository if you are prototyping AI features on Azure SQL Database and want runnable references for embeddings, RAG, content moderation or an MCP server, and if you accept that each sample is self-contained with its own dependencies. Do not adopt it if you need a supported, versioned library with a release cadence: the repository has no releases, and the README does not document rollback or upgrade paths for the notebooks.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 105 days ago.
- What is it written in?
- Mainly HTML, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What SQL-AI-samples actually is, and who it is for
This repository is a catalogue of samples, not a package. The README describes it as hosting "samples meant to help design AI applications built on data from an Azure SQL Database", and the top-level layout confirms that shape: separate directories such as AzureSQLDatabase/, AzureSQLACSSamples/, AzureSQLPromptFlowSamples/, AzureSQLFaiss/ and AgentMode/, each holding notebooks, T-SQL scripts or a small application. There is no build system at the root, no published artifact, and no release list.
The audience is therefore narrow and specific. You are a developer or data engineer who already has an Azure SQL Database and wants to see how embeddings, vector similarity, natural-language-to-SQL and retrieval-augmented generation are wired together against that database. The samples mix languages and runtimes on purpose: Python notebooks for LangChain and Vanna.AI, T-SQL scripts for calling Azure OpenAI directly from the database, and a C# Model Context Protocol server in MssqlMcp/. If you are looking for something to add to requirements.txt or package.json, this is the wrong repository.
How the samples are organised: notebooks, T-SQL and an MCP server
The README splits the content into AI Features Samples, End-To-End Samples and Workshops. That division is the closest thing to an architecture the repository offers, and it maps to three different integration points.
The first integration point is inside the database. The Retrieval Augmented Generation (T-SQL Sample) section describes a step-by-step guide for doing RAG "directly from the Azure SQL database itself", and the Content Moderation folder holds two T-SQL scripts that call Azure OpenAI Content Safety and Language AI. In that model the database is not just storage; it is the caller, and the model response comes back into a query.
The second integration point is the application layer. The LangChain folder contains two Python notebooks that build a NL2SQL agent against Azure SQL Database, using either Azure OpenAI or OpenAI as the LLM. The Vanna.AI notebook uses the vanna Python package to generate SQL with RAG plus an LLM, including connecting to a database and training. AzureSQLPromptFlowSamples/ goes further and links Prompt Flow, Azure Cognitive Search and Azure OpenAI, with instructions for indexing data and exposing the flow as an Azure ML endpoint.
The third integration point is tooling. MssqlMcp/ is a Model Context Protocol server for MSSQL databases built on the official MCP C# SDK, which is a different proposition from the notebooks: it is a component an agent runtime connects to, rather than a script a human reads.
Installing and running your first sample
There is no repository-wide install command, because there is no repository-wide artifact. The README's only concrete on-ramp is for the LangChain notebooks: it states that to get started immediately you can create a codespace on this repository, use the terminal to change to the LangChain directory, and follow one of the notebooks.
That translates to a short sequence. The .devcontainer/ directory at the top level is what backs the codespace route, so opening the repository in a codespace gives you a prepared environment rather than a bare container.
cd AzureSQLDatabase/LangChain
lsAfter changing directory you should see the two notebooks the README refers to, one for Azure OpenAI and one for OpenAI. Open the one matching the endpoint you have credentials for and run the cells from the top. The README does not document environment variables for these notebooks, so treat the notebook cells themselves as the source of truth for connection strings and keys.
The other samples follow the same pattern: each folder carries its own setup. For the Azure OpenAI vector embedding example the README points to a separate repository, azure-sql-db-openai, rather than giving steps here. For the RAG T-SQL sample it points to azure-sql-db-chatbot. Read the linked repository's README before assuming the steps are the same as the LangChain ones.
Where the samples stop being useful
The most honest limitation is that this is a sample collection with no versioning. The repository has no releases, so there is no tag to pin, no changelog to read, and no way to tell whether a notebook you copied six months ago still matches the current service APIs. The README does not document rollback or upgrade paths for any sample.
A second constraint is dependency sprawl. Between Python notebooks, T-SQL scripts, a C# MCP server and a Prompt Flow example, there is no shared runtime and no shared dependency file. Moving from one sample to another means rebuilding your environment. If your goal is a single coherent codebase, you will spend more time reconciling these samples than writing new code.
A third issue is that several samples are not self-contained at all. The Azure SQL + Azure OpenAI section is a pointer to another repository. The LangChain section points to azure-sql-langchain for the getting-started material. The Similar Content Finder points to azure-sql-db-session-recommender. The README is partly an index of other projects, which makes it a poor place to judge the maturity of any single one.
Finally, the samples assume Azure. The Azure Cognitive Search notebook relies on "new preview features of Azure Cognitive Search, including automatic chunking and integrated vectorization". Preview features change. If you need a stable target, this repository is not the place to find one.
Compared with sqlite-vec and pgvector
The natural alternative depends on what you are trying to do. If you want vector search inside an existing relational database without an Azure dependency, pgvector for PostgreSQL and sqlite-vec for SQLite solve the same storage-and-similarity problem at the engine level. They are extensions you install into the database, documented as such, with their own release history.
The difference in approach is where the intelligence lives. pgvector and sqlite-vec give you a distance operator and an index type, and everything else, including embedding generation, happens in your application. SQL-AI-samples goes the other way: the T-SQL RAG sample and the Content Moderation scripts call Azure OpenAI from inside the database, so the model invocation is part of the query rather than part of the client. That is a real architectural choice with real consequences, since it ties your SQL workload to an external service and its latency.
A second alternative sits closer to the MCP sample. If you want an agent to query a database, you can write a thin tool wrapper yourself instead of adopting the MssqlMcp server. The trade-off is that the MCP server implements a protocol your agent runtime may already speak, while a hand-written wrapper only works with your own code.
Maintenance, licensing and what to check before you copy code
The repository is not archived, and the last push was on 2026-06-03. That is recent enough that the samples are unlikely to be stale against current Azure APIs, but it tells you nothing about support commitments. The README does not describe a support policy, and there are no releases to indicate a cadence.
The licence is MIT, which is permissive and places few obligations on reuse. That is a benefit for copying a T-SQL script or a notebook cell into your own project. It is worth noting that MIT covers the code in this repository; the Azure services the samples call are governed by their own terms, and the samples do not discuss cost, quota or data-residency implications of sending your database content to those services.
Before copying anything into production, check three things in the specific folder you are using: whether it depends on a preview feature, whether it calls an external service at query time, and whether its own README (where one exists) lists prerequisites the root README omits. The root README is an index, and indexes hide detail.
Editorial conclusion
Adopt this repository if you are prototyping AI features on Azure SQL Database and want runnable references for embeddings, RAG, content moderation or an MCP server, and if you accept that each sample is self-contained with its own dependencies. Do not adopt it if you need a supported, versioned library with a release cadence: the repository has no releases, and the README does not document rollback or upgrade paths for the notebooks. Before committing, open the specific sample folder you intend to use, check its own README and dependency list, and confirm the Azure services it calls (Azure OpenAI, Cognitive Search, Azure ML) exist in your subscription and region.
Frequently asked questions
What is SQL in AI?
In this repository the relationship runs both ways: the samples use Azure SQL Database as the data store behind AI applications, and some of them call Azure OpenAI models from T-SQL so the database itself performs retrieval-augmented generation.
What is SQL and examples?
SQL is the query language used against Azure SQL Database here, and the repository provides worked examples rather than a language reference: a Vanna.AI notebook that generates SQL, two LangChain notebooks that build a NL2SQL agent, and T-SQL scripts for content moderation.
What are some AI tools used for SQL development?
The samples cover Azure OpenAI for embeddings and chat, Azure Cognitive Search for indexing and integrated vectorization, Prompt Flow for orchestration, LangChain and Vanna.AI for natural-language-to-SQL, and a C# Model Context Protocol server for MSSQL databases.
Is SQL hard for beginners?
The README does not address the difficulty of learning SQL. What it does show is that the samples assume you already have an Azure SQL Database and are comfortable running notebooks or T-SQL scripts against it.
Community notes