This project demonstrates how to use Azure Table Storage with a Minimal API and .NET Aspire - a cloud-ready stack for building observable, production-ready, distributed applications.
AspireAzStorage is a sample application that shows how to:
- Use .NET Aspire to build cloud-native applications
- Integrate Azure Table Storage in an Aspire application
- Implement a Minimal API
- Utilize the Azure Storage Emulator for local development
- Add observability with OpenTelemetry
The application manages employee data through various endpoints that allow you to:
- Generate sample employee data
- Query employees by various criteria
- Group employees by country or first letter of name
-
Docker Desktop or Podman (for local development)
-
Azure Developer CLI (for deployment)
azd init -t FBoucher/AspireAzStorage
or if you prefer, you can clone it with the folling command:
git clone https://github.com/yourusername/AspireAzStorage.git
cd AspireAzStorage
Make sure Docker or Podman are running. From your code editor start the project in the AspireAzStorage.AppHost
folder, or use "F5". You can also use the command line to run the application:
dotnet run --project AspireAzStorage.AppHost
This will start:
- The .NET Aspire dashboard
- The API application
- Azure Storage Emulator
The Aspire dashboard will open automatically, showing you all the components and their status.
Use the included Api.http file to test the API endpoints, or send requests to the following endpoints:
- Generate sample data: GET https://localhost:7125/api/generate/10 (mandatory to generate data before querying)
- Get all employees: GET https://localhost:7125/api/GetEmployeesAsync
- Get employees by country: GET https://localhost:7125/api/GetEmployeeByCountryAsync
- Get employees by last name's first letter: GET https://localhost:7125/api/employees/B
- Get employees grouped by first letter of first name: GET https://localhost:7125/api/employeesGroupByFirstLetterFirstNameAsync
-
If you haven't already, log in to your Azure account with
azd auth login
. -
Provision all required Azure resources and deploy the application with the following command:
azd up
-
Get the application URL
After the deployment is complete, you will see the URL of your application (A) in the terminal; the one starting by https://api.
. There is also many details about the resources created in Azure, and a link to the .NET Aspire dashboard (B).
Have questions or found an issue? We'd love to hear from you!
Issues: Please report bugs or feature requests through the Issues page. Contributions: Pull requests are welcome! Please feel free to contribute to this project.
This project is licensed under the MIT License - see the LICENSE file for details.