RepoMicrosoftMicrosoftpublished Jun 25, 2026seen Jun 26

microsoft/LAB513-Build-an-AI-Powered-FAQ-Assistant-with-Azure-SQL

Open original ↗

Captured source

source ↗

microsoft/LAB513-Build-an-AI-Powered-FAQ-Assistant-with-Azure-SQL

License: MIT

Stars: 0

Forks: 1

Open issues: 1

Created: 2026-06-25T19:50:36Z

Pushed: 2026-06-25T19:52:30Z

Default branch: main

Fork: no

Archived: no

README:

Introduction - Azure SQL Hyperscale for AI and RAG Workloads

This workshop is built on Azure SQL Hyperscale, a cloud-native database architecture designed for high-performance, scalable, and AI-driven applications.

Why Hyperscale?

Azure SQL Hyperscale separates compute and storage, enabling:

  • Independent scaling of compute and storage
  • Rapid database growth (up to 100 TB)
  • High-performance workloads with minimal latency
  • Fast database backups and restores

Key features for AI scenarios

This workshop leverages Hyperscale capabilities to support modern AI patterns:

  • Vector support for semantic search and embeddings
  • High throughput for retrieval workloads (RAG)
  • Separation of compute and storage for scalable AI pipelines
  • Integration with Azure services such as:
  • Azure OpenAI
  • Microsoft Fabric
  • Microsoft Foundry Agents

Why it matters for this lab

In this workshop, Azure SQL Hyperscale enables:

  • Efficient storage of FAQ content + vector embeddings
  • Fast execution of semantic search queries
  • Scalable backend for Retrieval-Augmented Generation (RAG)

You'll use Hyperscale as the foundation for:

  • Vector search
  • AI grounding
  • Agent orchestration
  • Analytics with Fabric

> In real-world AI applications, Hyperscale is ideal when combining transactional + AI + analytics workloads.

===

Exercise 1 - AI-enhanced querying with Azure SQL Hyperscale

Learning objective

In this exercise, you'll use Visual Studio Code to connect to Azure SQL Hyperscale, inspect the FAQ knowledge base, and run a semantic search query using vector embeddings.

By the end of this exercise, you'll be able to:

  • Connect to Azure SQL using VS Code.
  • Explore FAQ data stored in the database.
  • Inspect vector embeddings.
  • Run a semantic similarity query to retrieve relevant FAQ answers.

---

Steps

1. Open Visual Studio Code from the desktop.

1. Select the SQL Server icon in the Activity Bar.

![itosldk0.png](../../media/itosldk0.png)

1. In Connections, select + Add Connection.

![hqyq7nso.png](../../media/hqyq7nso.png)

1. Configure the connection to the workshop database.

  • In the Connect to Database dialog, use the following values:

| Setting | Value | | ----------------------- | ----------------------------------------------------------- | | Profile Name | FAQ | | Input type | Parameters | | Server name | faq-ai-assistant-@lab.LabInstance.Id.database.windows.net | | Authentication type | Microsoft Entra ID - Universal with MFA support | | Database name | faq-ai-assistant-db | | Encrypt | Mandatory |

> This lab uses Azure SQL Hyperscale for scalable AI workloads.

![642dyvix.png](../../media/642dyvix.png)

1. Select Sign in and authenticate with your Microsoft Entra ID account:

Username: @lab.CloudPortalCredential(User1).Username TAP: @lab.CloudPortalCredential(User1).AccessToken

![6ggh01ry.png](../../media/6ggh01ry.png)

> Close the browser tab after signing in.

1. Select Connect. In the SQL Server extension panel, hover over the new connection and verify that the faq-ai-assistant-db database is available.

![jye888g9.png](../../media/jye888g9.png)

![y4cal7ce.png](../../media/y4cal7ce.png)

1. After the connection is created, open a new SQL query window.

  • Select Ctrl + Shift + P
  • Select: MS SQL: New Query

1. Ensure the query window is connected to the database faq-ai-assistant-db. You should see the database name displayed in the bottom status bar.

![i2ys8njv.png](../../media/i2ys8njv.png)

---

Explore the FAQ knowledge base

1. In the query window, run the following query to view the FAQ content table.

sql SELECT TOP 10 * FROM dbo.FAQ_Content;

![2hl8shze.png](../../media/2hl8shze.png)

1. Review the results returned.

- You should see columns such as **faq_id**, **category**, **question**, and **answer**.
- Example:

| faq_id | category | question |
| ------ | -------- | ------------------------ |
| 1 | Orders | How do I track my order? |

> This table stores the **FAQ knowledge base used by the AI assistant**.

![x97lg4nx.png](../../media/x97lg4nx.png)

---

# Inspect the embeddings table

1. Run the following query to view the embeddings table.

sql
SELECT TOP 5 *
FROM dbo.FAQ_Embeddings;

![aidtgme1.png](../../media/aidtgme1.png)

1. Review the results returned.

- You should see:

| faq_id | question_embedding |
| ------ | ------------------ |

![fulfasu6.png](../../media/fulfasu6.png)

>[!note]The column **question_embedding** stores a **vector representation of each question**.

>[!note]These vectors were generated earlier using **Azure OpenAI embeddings**.

>[!note]Each embedding contains **1536 numeric values representing semantic meaning**.

---

# Validate data loaded correctly

1. Run the following query to confirm how many FAQ records exist.

sql
SELECT COUNT(*) AS faq_count
FROM dbo.FAQ_Content;

![8xyajaja.png](../../media/8xyajaja.png)

1. Run the following query to confirm how many embeddings were loaded.

sql SELECT COUNT(*) AS embedding_count FROM dbo.FAQ_Embeddings;

![ulfxwm8h.png](../../media/ulfxwm8h.png)

1. Compare the results.

- Both counts should match.
- This confirms every FAQ question has a corresponding embedding.

---

# Run a semantic search query

1. Assume a user states the following:

-nocode
My product arrived damaged.

1. To simulate semantic search, call the stored procedure which generates the query embedding and performs the vector search for you.

sql EXEC dbo.SearchFAQ @user_question = N'My product arrived damaged';

![61ohnvfq.png](../../media/61ohnvfq.png)

Review the results returned. The procedure returns the most relevant FAQ rows (by default the top 3) and typically includes these columns:

- **faq_id**: the FAQ record identifier
- **category**: FAQ category (Orders, Returns, and so on)
- **question**: the stored FAQ question
- **answer**: the stored answer text

Results are ordered by semantic similarity (cosine distance) so the top rows are the most relevant. You should see entries such as:

- **How do I return a damaged item?**
- **What if I received the wrong item?**

Notice that the wording does not...

Excerpt shown — open the source for the full document.

Notability

notability 3.0/10

Routine training lab repo