This project demonstrates a file-based Azure Functions application orchestrated using Aspire. It showcases how to model and deploy Azure Functions as individual C# files within an Aspire distributed application.
This application models file-based Azure Functions apps using a custom Aspire extension. Instead of traditional project-based Functions, each function is defined in a single .cs file with inline package references and dependencies. The Aspire app host orchestrates these functions along with their required infrastructure (Azure Storage).
The project includes two sample functions:
http.cs: An HTTP-triggered function that responds to GET and POST requeststimer.cs: A timer-triggered function that executes every 10 seconds
- .NET 10 SDK (RC 2 or later)
- Aspire 13
Run the application locally using the Aspire orchestrator:
aspire runThis command will:
- Start the Aspire dashboard
- Launch the Azure Storage emulator (Azurite)
- Start both function apps (timer and http)
- Provide telemetry and logging through the Aspire dashboard
The Aspire dashboard will be available at http://localhost:17193 (or another port if configured), where you can:
- Monitor function execution
- View logs and traces
- Inspect resource health
- Test HTTP endpoints
Once running, the HTTP function will be accessible through the Aspire dashboard's endpoints section. You can send requests to test it:
curl http://localhost:<assigned-port>/api/HttpTriggerImplDeploy the application to Azure Container Apps:
aspire deployThis command will:
- Prompt you to select or create an Azure subscription
- Provision necessary Azure resources (Container App Environment, Storage Account)
- Build and deploy both function apps as containers to ACA Native Functions
- Configure networking and environment variables
After deployment, the command will output the URLs for your deployed functions.
apphost.cs: The Aspire app host that orchestrates the functions and infrastructurehttp.cs: HTTP-triggered function implementationtimer.cs: Timer-triggered function implementationhost.json: Azure Functions host configurationlocal.settings.json: Local development settingsglobal.json: .NET SDK version specification
This project uses a file-based approach to Azure Functions where:
- Each function is defined in a single .cs file
- Package references are declared inline using
#:packagedirectives - The Aspire
AddFunctionAppextension method orchestrates the functions - Azure Storage is automatically provisioned and configured
- OpenTelemetry integration is enabled for observability
The FunctionsExtensions class in apphost.cs provides the AddFunctionApp method that:
- Registers file-based function apps as Aspire resources
- Automatically provisions shared Azure Storage
- Configures Azure Functions runtime settings
- Enables OpenTelemetry for distributed tracing
- Sets up HTTP endpoints for both local and deployed scenarios=