eShopLite - Semantic Search is a reference .NET application implementing an eCommerce site with Search features using Keyword Search and Semantic Search.
- Features
- Architecture diagram
- Getting started
- Deploying to Azure
- Run solution
- Resources
- Video Recordings
- Guidance
- Resources
GitHub CodeSpaces: This project is designed to be opened in GitHub Codespaces as an easy way for anyone to deploy the solution entirely in the browser.
This is the eShopLite Aplication running, performing a Keyword Search:
This is the eShopLite Aplication running, performing a Semantic Search:
The Aspire Dashboard to check the running services:
The Azure Resource Group with all the deployed services:
The solution is in the ./src
folder, the main solution is eShopLite-Aspire.sln.
Once you've opened the project in Codespaces, or locally, you can deploy it to Azure.
From a Terminal window, open the folder with the clone of this repo and run the following commands.
-
Login to Azure:
azd auth login
-
Provision and deploy all the resources:
azd up
It will prompt you to provide an
azd
environment name (like "eShopLite"), select a subscription from your Azure account, and select a location where OpenAI the models gpt-4o-mini and ADA-002 are available (like "eastus2"). -
When
azd
has finished deploying, you'll see the list of resources created in Azure and a set of URIs in the command output. -
Visit the store URI, and you should see the eShop Lite app! 🎉
-
This is an example of the command output:
- Coming Soon! You can check this video with a 5 minutes overview of the deploy process from codespaces: Deploy Your eShopLite - Semantic Search to Azure in Minutes!.
Note: The deploy files are located in the ./src/eShopAppHost/infra/
folder. They are generated by the Aspire AppHost
project.
- Create a new Codespace using the
Code
button at the top of the repository.
-
The Codespace creation process can take a couple of minutes.
-
Once the Codespace is loaded, it should have all the necessary requirements to deploy the solution.
To run the project locally, you'll need to make sure the following tools are installed:
- .NET 9
- Git
- Azure Developer CLI (azd)
- Visual Studio Code or Visual Studio
- If using Visual Studio Code, install the C# Dev Kit
- .NET Aspire workload: Installed with the Visual Studio installer or the .NET CLI workload.
- An OCI compliant container runtime, such as:
- Docker Desktop or Podman.
Follow these steps to run the project, locally or in CodeSpaces:
- Navigate to the Aspire Host folder project using the command:
cd ./src/eShopAppHost/
- Run the project:
dotnet run
In order to use existing models: gpt-4o-mini and text-embedding-ada-002, you need to define the specific connection string in the Products
project.
Add a user secret with the configuration:
{
"ConnectionStrings:openaidev": "Endpoint=https://<endpoint>.openai.azure.com/;Key=<key>;"
}
The Products
project add the Azure OpenAI clients using the configuration from the User Secrets in the Dev Environment. If you want to use the services provided by the AppHost
, open the the program.cs
, and change this:
// Add Azure OpenAI client
var azureOpenAiClientName = builder.Environment.IsDevelopment() ? "openaidev" : "openai";
builder.AddAzureOpenAIClient(azureOpenAiClientName);
to this:
// Add Azure OpenAI client
var azureOpenAiClientName = "openai";
builder.AddAzureOpenAIClient(azureOpenAiClientName);
For Azure OpenAI Services, pricing varies per region and usage, so it isn't possible to predict exact costs for your usage. The majority of the Azure resources used in this infrastructure are on usage-based pricing tiers. However, Azure Container Registry has a fixed cost per registry per day.
You can try the Azure pricing calculator for the resources:
- Azure OpenAI Service: S0 tier, gpt-4o-mini and text-embedding-ada-002 models. Pricing is based on token count. Pricing
- Azure Container App: Consumption tier with 0.5 CPU, 1GiB memory/storage. Pricing is based on resource allocation, and each month allows for a certain amount of free usage. Pricing
- Azure Container Registry: Basic tier. Pricing
- Log analytics: Pay-as-you-go tier. Costs based on data ingested. Pricing
azd down
.
Samples in this templates uses Azure OpenAI Services with ApiKey and Managed Identity for authenticating to the Azure OpenAI service.
The Main Sample uses Managed Identity](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/overview) for authenticating to the Azure OpenAI service.
Additionally, we have added a GitHub Action that scans the infrastructure-as-code files and generates a report containing any detected issues. To ensure continued best practices in your own repository, we recommend that anyone creating solutions based on our templates ensure that the Github secret scanning setting is enabled.
You may want to consider additional security measures, such as:
- Protecting the Azure Container Apps instance with a firewall and/or Virtual Network.
- Coming soon!