You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Deploy a .NET Blazor app connected to Azure SQL and Azure OpenAI on Azure App Service
13
13
14
-
When creating intelligent apps, you may want to ground the context of your app using your own SQL data. With the recent announcement of [Azure SQL vector support (preview)](https://devblogs.microsoft.com/azure-sql/announcing-eap-native-vector-support-in-azure-sql-database/), you can ground the context using the Azure SQL data you already have with new [vector functions](https://learn.microsoft.com/en-us/sql/t-sql/functions/vector-functions-transact-sql?view=azuresqldb-current) that will help manage vector data.
14
+
When creating intelligent apps, you may want to ground the context of your app using your own SQL data. With the recent announcement of [Azure SQL vector support (preview)](https://devblogs.microsoft.com/azure-sql/announcing-eap-native-vector-support-in-azure-sql-database/), you can ground the context using the Azure SQL data you already have with new [vector functions](https://learn.microsoft.com/en-us/sql/t-sql/functions/vector-functions-transact-sql?view=azuresqldb-current) that help manage vector data.
15
15
16
-
In this tutorial, you'll learn how to 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 will build from the previous documentation to deploy a [.NET Blazor app with OpenAI](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet).
16
+
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](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet).
17
17
18
18
#### Prerequisites
19
19
20
20
- An [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?pivots=programming-language-csharp&tabs=command-line%2Ckeyless%2Ctypescript-keyless%2Cpython#set-up) resource with deployed models
21
21
- A .NET 8 or 9 Blazor Web App deployed on App Service
22
22
- An Azure SQL database resource with vector embeddings.
23
23
24
-
### Setup Blazor web app
24
+
### Set up Blazor web app
25
25
26
-
For this example, we'll be creating a simple chat box to interact with. If you're using the prerequisite .NET Blazor app from the [previous article](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet), you can skip the changes to the *OpenAI.razor* file as those are the same. However, you will need to make sure the following packages are installed:
26
+
For this example, we are 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 these are the same. However, you need to make sure the following packages are installed:
27
27
28
28
Install the following packages to interact with Azure OpenAI and Azure SQL.
29
29
@@ -33,7 +33,7 @@ Install the following packages to interact with Azure OpenAI and Azure SQL.
33
33
1. Right click on the **Pages** folder found under the **Components** folder and add a new item named *OpenAI.razor*
34
34
2. Add the following code to the *OpenAI.razor* file and click **Save** to create the chat box
@@ -59,11 +59,11 @@ Install the following packages to interact with Azure OpenAI and Azure SQL.
59
59
60
60
### API keys and endpoints
61
61
62
-
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](https://learn.microsoft.com/en-us/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](https://learn.microsoft.com/en-us/azure/app-service/deploy-intelligent-apps?pivots=openai-dotnet#secure-your-app-with-managed-identity) to setup your Azure OpenAI client in the next step to use managed identity with Azure OpenAI.
62
+
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](https://learn.microsoft.com/en-us/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](https://learn.microsoft.com/en-us/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.
63
63
64
64
### Add Azure OpenAI client
65
65
66
-
After adding the chat interface, we can setup the Azure OpenAI client using Semantic Kernel. Add the following code to create the client that will connect to your Azure OpenAI resource. You will need to use your Azure OpenAI API keys and endpoint information that were setup and handled in the previous step.
66
+
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.
Thesetwomodelswillneedtobedeployedbeforecontinuingthenextstep. Pleasevisitthe [documentation](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-openai) for deploying models with Azure OpenAI using Azure AI Foundry.
141
+
Thesetwomodelsneedtobedeployedbeforecontinuingthenextstep. Visitthe [documentation](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-openai) for deploying models with Azure OpenAI using Azure AI Foundry.
142
142
143
143
### Vectorize your SQL database
144
144
145
-
InordertoperformahybridvectorsearchonyourAzureSQLdatabase, youwillfirstneedtohavetheappropriateembeddingsinyourdatabase. Thereareanumberofwaysyoucanvectorizeyourdatabase. Oneoptionistousethefollowing [AzureSQLdatabasevectorizer](https://github.com/Azure-Samples/azure-sql-db-vectorizer) to generate embeddings for your SQL database. Vectorize your Azure SQL database before continuing.
145
+
ToperformahybridvectorsearchonyourAzureSQLdatabase, youfirstneedtohavetheappropriateembeddingsinyourdatabase. Thereareanumberofwaysyoucanvectorizeyourdatabase. Oneoptionistousethefollowing [AzureSQLdatabasevectorizer](https://github.com/Azure-Samples/azure-sql-db-vectorizer) to generate embeddings for your SQL database. Vectorize your Azure SQL database before continuing.
146
146
147
147
### Create procedure to generate embeddings
148
148
149
-
With [AzureSQLvectorsupport (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 will invoke an external REST API endpoint to get the embeddings. See the [documentation](https://learn.microsoft.com/en-us/azure-data-studio/quickstart-sql-database) to use Azure Data Studio to connect to your database before running the query.
149
+
With [AzureSQLvectorsupport (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/en-us/azure-data-studio/quickstart-sql-database) to use Azure Data Studio to connect to your database before running the query.
0 commit comments