Skip to content

Commit 4b33da1

Browse files
committed
updating steps
1 parent 58e3366 commit 4b33da1

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

articles/app-service/deploy-intelligent-apps-dotnet-to-azure-sql.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'Deploy a .NET Blazor app connected to Azure SQL and Azure OpenAI on Azure App Service'
33
description: Get started connecting Azure SQL to your OpenAI app
4-
author: jefmarti
4+
author: jeffwmartinez
55
ms.author: jefmarti
66
ms.date: 02/10/2025
77
ms.topic: article
@@ -15,13 +15,13 @@ When creating intelligent apps, you may want to ground the context of your app u
1515

1616
In this tutorial, you'll create a RAG sample application by setting up a Hybrid vector search against your Azure SQL database using a .NET 8 Blazor app. This example builds from the previous documentation to deploy a [.NET Blazor app with OpenAI](/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet).
1717

18-
#### Prerequisites
18+
## Prerequisites
1919

2020
- An [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/quickstart?pivots=programming-language-csharp&tabs=command-line%2Ckeyless%2Ctypescript-keyless%2Cpython#set-up) resource with deployed models
2121
- A .NET 8 or 9 Blazor Web App deployed on App Service
2222
- An Azure SQL database resource with vector embeddings.
2323

24-
### Set up Blazor web app
24+
## 1. Set up Blazor web app
2525

2626
For this example, we're creating a simple chat box to interact with. If you're using the prerequisite .NET Blazor app from the [previous article](/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet), you can skip the changes to the *OpenAI.razor* file as the content is the same. However, you need to make sure the following packages are installed:
2727

@@ -61,7 +61,7 @@ Install the following packages to interact with Azure OpenAI and Azure SQL.
6161

6262
Using the Azure OpenAI resource requires the use of API keys and endpoint values. See the documentation in the previous article for setting up [Azure Key Vault references](/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet#api-keys-and-endpoints) to manage and handle your secrets with Azure OpenAI. Although not required, we do recommend using managed identity to secure your client without the need to manage API keys. See the previous [documentation](/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet#secure-your-app-with-managed-identity) to set up your Azure OpenAI client in the next step to use managed identity with Azure OpenAI.
6363

64-
### Add Azure OpenAI client
64+
## 2. Add Azure OpenAI client
6565

6666
After adding the chat interface, we can set up the Azure OpenAI client using Semantic Kernel. Add the following code to create the client that connects to your Azure OpenAI resource. You need to use your Azure OpenAI API keys and endpoint information that were set up and handled in the previous step.
6767

@@ -129,19 +129,19 @@ After adding the chat interface, we can set up the Azure OpenAI client using Sem
129129

130130
From here, you should have a working chat application that is connected to OpenAI. Next, we'll set up our Azure SQL database to work with our chat application.
131131

132-
### Deploy Azure OpenAI models
132+
## 3. Deploy Azure OpenAI models
133133

134-
In order to prepare your Azure SQL database for vector search, you need to make use of an embedding model to generate embeddings used for searching in addition to your initial deployed chat model. For this example, we're using the following models:
134+
In order to prepare your Azure SQL database for vector search, you need to make use of an embedding model to generate embeddings used for searching in addition to your initial deployed language model. For this example, we're using the following models:
135135
- `text-embedding-ada-002` is used to generate the embeddings
136136
- `gpt-3.5-turbo` is used for the language model
137137

138138
These two models need to be deployed before continuing the next step. Visit the [documentation](https://learn.microsoft.com/azure/ai-studio/how-to/deploy-models-openai) for deploying models with Azure OpenAI using Azure AI Foundry.
139139
140-
### Vectorize your SQL database
140+
## 4. Vectorize your SQL database
141141

142142
To perform a hybrid vector search on your Azure SQL database, you first need to have the appropriate embeddings in your database. There are many ways you can vectorize your database. One option is to use the following [Azure SQL database vectorizer](https://github.com/Azure-Samples/azure-sql-db-vectorizer) to generate embeddings for your SQL database. Vectorize your Azure SQL database before continuing.
143143
144-
### Create procedure to generate embeddings
144+
## 5. Create procedure to generate embeddings
145145

146146
With [Azure SQL vector support (preview)](https://devblogs.microsoft.com/azure-sql/announcing-eap-native-vector-support-in-azure-sql-database/), you can create a stored procedure that will use a Vector data type to store generated embeddings for search queries. The stored procedure invokes an external REST API endpoint to get the embeddings. See the [documentation](https://learn.microsoft.com/azure-data-studio/quickstart-sql-database) to use Azure Data Studio to connect to your database before running the query.
147147
@@ -181,7 +181,7 @@ GO
181181

182182
After creating your stored procedure, you should be able to view it under the **Stored Procedures** folder found in the **Programmability** folder of your SQL database. Once created, you can run a test [similarity search](https://devblogs.microsoft.com/azure-sql/announcing-eap-native-vector-support-in-azure-sql-database/#similarity-search-in-azure-sql-db) within your SQL query editor using your text embedding model name. This uses your stored procedure to generate embeddings and use a vector distance function to calculate the vector distance and return results based on the text query.
183183
184-
### Connect and search your database
184+
## 6. Connect and search your database
185185

186186
Now that your database is set up to create embeddings, we can connect to it in our application and set up the Hybrid vector search query.
187187

@@ -309,7 +309,7 @@ GRANT EXECUTE ANY EXTERNAL ENDPOINT TO "<your-app-name>";
309309
GO
310310
```
311311

312-
From here, your Azure SQL database is now secure, and you can deploy your application to App Service as you normally would.
312+
From here, your Azure SQL database is now secure, and you can deploy your application to App Service.
313313

314314
Here's the full example of the added *OpenAI.razor* page:
315315

articles/app-service/includes/deploy-intelligent-apps/deploy-intelligent-apps-linux-dotnet-pivot.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ ms.author: jefmarti
1010

1111
You can use Azure App Service to work with popular AI frameworks like LangChain and Semantic Kernel connected to OpenAI for creating intelligent apps. In the following tutorial, we're adding an Azure OpenAI service using Semantic Kernel to a .NET 8 Blazor web application.
1212

13-
#### Prerequisites
13+
## Prerequisites
1414

1515
- An [Azure OpenAI resource](/azure/ai-services/openai/quickstart?pivots=programming-language-csharp&tabs=command-line%2Cpython#set-up) or an [OpenAI account](https://platform.openai.com/overview).
1616
- A .NET 8 Blazor Web App. Create the application with a template [here](https://dotnet.microsoft.com/learn/aspnet/blazor-tutorial/intro).
1717

18-
### Setup Blazor web app
18+
## 1. Setup Blazor web app
1919

2020
For this Blazor web application, we're building off the Blazor [template](https://dotnet.microsoft.com/learn/aspnet/blazor-tutorial/intro) and creating a new razor page that can send and receive requests to an Azure OpenAI OR OpenAI service using Semantic Kernel.
2121

@@ -128,7 +128,7 @@ For OpenAI:
128128
}
129129
```
130130

131-
### Semantic Kernel
131+
## 2. Semantic Kernel
132132

133133
Semantic Kernel is an open-source SDK that enables you to easily develop AI agents to work with your existing code. You can use Semantic Kernel with Azure OpenAI and OpenAI models.
134134

@@ -137,7 +137,7 @@ To create the OpenAI client, we'll first start by installing Semantic Kernel.
137137
To install Semantic Kernel, browse the NuGet package manager in Visual Studio and install the **Microsoft.SemanticKernel** package. For NuGet Package Manager instructions, see [here](/nuget/consume-packages/install-use-packages-visual-studio#find-and-install-a-package). For CLI instructions, see [here](/nuget/consume-packages/install-use-packages-dotnet-cli).
138138
Once the Semantic Kernel package is installed, you can now initialize the kernel.
139139

140-
### Initialize the kernel
140+
## 3. Initialize the kernel
141141

142142
To initialize the Kernel, add the following code to the *OpenAI.razor* file.
143143

@@ -159,7 +159,7 @@ To initialize the Kernel, add the following code to the *OpenAI.razor* file.
159159

160160
Here we're adding the using statement and creating the Kernel in a method that we can use when we send the request to the service.
161161

162-
### Add your AI service
162+
## 4. Add your AI service
163163

164164
Once the Kernel is initialized, we can add our chosen AI service to the kernel. Here we define our model and pass in our key and endpoint information to be consumed by the chosen model. If you plan to use managed identity with Azure OpenAI, add the service using the example in the next section.
165165

@@ -225,7 +225,7 @@ Once the credentials are added to the application, you'll then need to enable ma
225225

226226
Your web app is now added as a cognitive service OpenAI user and can communicate to your Azure OpenAI resource.
227227

228-
### Configure prompt and create semantic function
228+
## 5. Configure prompt and create semantic function
229229

230230
Now that our chosen OpenAI service client is created with the correct keys we can add a function to handle the prompt. With Semantic Kernel you can handle prompts by the use of a semantic function, which turn the prompt and the prompt configuration settings into a function the Kernel can execute. Learn more on configuring prompts [here](/semantic-kernel/prompts/configure-prompts?tabs=Csharp).
231231

@@ -348,7 +348,7 @@ Here's the example in its completed form. In this example, use the Azure OpenAI
348348

349349
Now save the application and follow the next steps to deploy it to App Service. If you would like to test it locally first at this step, you can swap out the config values at with the literal string values of your OpenAI service. For example: string modelId = 'gpt-4-turbo';
350350

351-
### Deploy to App Service
351+
## 5. Deploy to App Service
352352

353353
If you have followed the steps above, you're ready to deploy to App Service. If you run into any issues remember that you need to have done the following: grant your app access to your Key Vault, add the app settings with key vault references as your values. App Service resolves the app settings in your application that match what you've added in the portal.
354354

@@ -357,3 +357,9 @@ If you have followed the steps above, you're ready to deploy to App Service. If
357357
Although optional, it's highly recommended that you also add authentication to your web app when using an Azure OpenAI or OpenAI service. This can add a level of security with no other code. Learn how to enable authentication for your web app [here](../../scenario-secure-app-authentication-app-service.md).
358358

359359
Once deployed, browse to the web app and navigate to the OpenAI tab. Enter a query to the service and you should see a populated response from the server. The tutorial is now complete and you now know how to use OpenAI services to create intelligent applications.
360+
361+
## Next step
362+
363+
> [!div class="nextstepaction"]
364+
> [Deploy a .NET Blazor app connected to Azure SQL and Azure OpenAI on Azure App Service](/azure/app-service/deploy-intelligent-apps-dotnet-to-azure-sql.md)
365+

0 commit comments

Comments
 (0)