Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/vector-search-typescript-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# CI for the Azure SQL Vector Search TypeScript quickstart sample.
# Security: uses `pull_request` (read-only token, no secrets on forks)
# with an explicit same-repo check to skip fork PRs entirely.

name: "Vector Search TypeScript — Build"

on:
pull_request:
branches: [master]
paths:
- "samples/features/vector-search/vector-search-query-typescript/**"
push:
branches: [master]
paths:
- "samples/features/vector-search/vector-search-query-typescript/**"

# Cancel redundant runs for the same PR / branch.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Build & type-check
runs-on: ubuntu-latest
timeout-minutes: 10

# Skip CI on fork PRs — prevents external actors from consuming minutes.
if: >-
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name

defaults:
run:
working-directory: samples/features/vector-search/vector-search-query-typescript

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: samples/features/vector-search/vector-search-query-typescript/package-lock.json

- name: Install dependencies
run: npm ci

- name: Type-check (build)
run: npm run build
20 changes: 20 additions & 0 deletions samples/features/vector-search/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Environment files
.env
.env.*
!.env.sample
!.env.example

# Dependencies
node_modules/

# Build artifacts
dist/
build/

# Logs
*.log
npm-debug.log*

# OS files
.DS_Store
Thumbs.db
56 changes: 56 additions & 0 deletions samples/features/vector-search/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Vector Search Samples for Azure SQL Database

Native vector search samples demonstrating the `VECTOR()` data type and `VECTOR_DISTANCE()` function in Azure SQL Database.

## Prerequisites

- Azure subscription — [Create one free](https://azure.microsoft.com/pricing/purchase-options/azure-account)
- [Azure Developer CLI (azd)](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd)
- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli)

## Quick start with Azure Developer CLI

Deploy all required Azure resources (Azure SQL Database + Azure OpenAI) with one command:

```bash
azd up --cwd samples/features/vector-search
```

This provisions:
- **Azure SQL Database** with native vector support
- **Azure OpenAI** with `text-embedding-3-small` deployment
- **Managed Identity** with appropriate role assignments

After deployment, create the `.env` file for the language samples:

```bash
azd env get-values --cwd samples/features/vector-search > samples/features/vector-search/vector-search-query-typescript/.env
```

This writes the deployment outputs (`AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_EMBEDDING_DEPLOYMENT`, `AZURE_SQL_SERVER`, `AZURE_SQL_DATABASE`, etc.) directly into the `.env` file that the samples read at runtime.

## Language samples

| Language | Folder | Description |
|----------|--------|-------------|
| TypeScript | [vector-search-query-typescript/](./vector-search-query-typescript/) | Vector search with Node.js, tedious driver, and Azure OpenAI |

## Infrastructure only

The `infra/` folder contains Bicep templates that can be deployed independently:

```bash
azd up --cwd infra # deploy infrastructure only
```

Or used as a module in your own Bicep templates.

## Contributing

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## Related content

- [Vectors in Azure SQL and SQL Server](https://learn.microsoft.com/sql/relational-databases/vectors/vectors-sql-server)
- [VECTOR_DISTANCE (Transact-SQL)](https://learn.microsoft.com/sql/t-sql/functions/vector-distance-transact-sql)
- [Azure OpenAI text embeddings](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#embeddings)
9 changes: 9 additions & 0 deletions samples/features/vector-search/azure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

name: sql-vector-search-quickstart
metadata:
template: sql-vector-search-quickstart

# Infrastructure outputs (AZURE_SQL_SERVER, AZURE_OPENAI_ENDPOINT, etc.)
# are defined in infra/main.bicep and automatically available via:
# azd env get-values
Loading