01 - Run Locally (Premium)¶
Build and run a .NET 8 isolated worker Function App locally before touching Azure resources.
Prerequisites¶
| Tool | Version | Purpose |
|---|---|---|
| .NET SDK | 8.0 (LTS) | Build and run isolated worker functions |
| Azure Functions Core Tools | v4 | Start local host and publish artifacts |
| Azure CLI | 2.61+ | Provision Azure resources and inspect app state |
Premium plan basics
Premium (EP1) keeps at least one warm instance, supports VNet integration, private endpoints, and deployment slots. No cold-start penalty, with up to 100 instances and no execution timeout.
What You'll Build¶
A .NET 8 isolated worker Function App with 16 functions that runs locally, returning JSON from /api/health, and validates the isolated hosting model before deployment.
flowchart LR
A[dotnet build] --> B[func start]
B --> C[HTTP Trigger endpoint]
C --> D[HttpRequest via ASP.NET Core]
D --> E[IActionResult response] Steps¶
Step 1 - Clone and navigate to the reference app¶
Step 2 - Review the project structure¶
apps/dotnet/
├── Functions/
│ ├── HealthFunction.cs
│ ├── HelloHttpFunction.cs
│ ├── InfoFunction.cs
│ ├── LogLevelsFunction.cs
│ ├── SlowResponseFunction.cs
│ ├── TestErrorFunction.cs
│ ├── UnhandledErrorFunction.cs
│ ├── DnsResolveFunction.cs
│ ├── IdentityProbeFunction.cs
│ ├── StorageProbeFunction.cs
│ ├── ExternalDependencyFunction.cs
│ ├── QueueProcessorFunction.cs
│ ├── BlobProcessorFunction.cs
│ ├── ScheduledCleanupFunction.cs
│ ├── TimerLabFunction.cs
│ └── EventHubLagProcessorFunction.cs
├── Shared/
│ └── AppConfig.cs
├── Program.cs
├── host.json
├── local.settings.json.example
└── AzureFunctionsGuide.csproj
Step 3 - Configure local settings¶
Verify the file contains:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"QueueStorage": "UseDevelopmentStorage=true",
"EventHubConnection": "Endpoint=sb://placeholder.servicebus.windows.net/;SharedAccessKeyName=placeholder;SharedAccessKey=cGxhY2Vob2xkZXI=;EntityPath=events"
}
}
Step 4 - Review Program.cs for isolated hosting¶
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
})
.Build();
host.Run();
Isolated worker model
The .NET isolated worker uses ConfigureFunctionsWebApplication() with ASP.NET Core integration. HTTP functions use HttpRequest and IActionResult from ASP.NET Core, and logging is constructor-injected with ILogger<T>.
Step 5 - Build and start the function host¶
Step 6 - Test the health endpoint¶
In a second terminal:
Expected response:
Test additional endpoints:
curl --request GET "http://localhost:7071/api/hello/World"
curl --request GET "http://localhost:7071/api/info"
Verification¶
Azure Functions Core Tools
Core Tools Version: 4.8.0
Function Runtime Version: 4.x.x.x
Functions:
blobProcessor: blobTrigger
dnsResolve: [GET] http://localhost:7071/api/dns/{hostname}
eventhubLagProcessor: eventHubTrigger
externalDependency: [GET] http://localhost:7071/api/dependency
health: [GET] http://localhost:7071/api/health
helloHttp: [GET] http://localhost:7071/api/hello/{name?}
identityProbe: [GET] http://localhost:7071/api/identity
info: [GET] http://localhost:7071/api/info
logLevels: [GET] http://localhost:7071/api/loglevels
queueProcessor: queueTrigger
scheduledCleanup: timerTrigger
slowResponse: [GET] http://localhost:7071/api/slow
storageProbe: [GET] http://localhost:7071/api/storage/probe
testError: [GET] http://localhost:7071/api/testerror
timerLab: timerTrigger
unhandledError: [GET] http://localhost:7071/api/unhandlederror
Next Steps¶
Next: 02 - First Deploy
See Also¶
- Tutorial Overview & Plan Chooser
- .NET Language Guide
- Platform: Hosting Plans
- Operations: Deployment
- Recipes Index