A simple, educational Azure Functions playground project for learning and experimenting with Azure Functions using the .NET isolated worker model.
This project demonstrates the basics of Azure Functions v4 with the .NET isolated worker model. It's designed as a learning resource for developers getting started with serverless computing on Azure.
- β HTTP-triggered Azure Function
- β Blob-triggered Function with output binding (copy blob between containers)
- β .NET Framework 4.8 with isolated worker model
- β Application Insights integration
- β Ready for local development and Azure deployment
Before you begin, ensure you have the following installed:
- .NET Framework 4.8 SDK
- Azure Functions Core Tools v4
- Visual Studio 2022 or VS Code with C# extension
- Azure CLI (for deployment)
- Azurite or Azure Storage Emulator (for local development)
git clone https://github.com/yourusername/FunctionApp101.git
cd FunctionApp101Create a local.settings.json file in the FunctionApp101 folder:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"APPLICATIONINSIGHTS_CONNECTION_STRING": "<your-connection-string>"
}
}Note: For local development,
UseDevelopmentStorage=truerequires Azurite to be running.
Using Azure Functions Core Tools:
cd FunctionApp101
func startOr using Visual Studio:
- Open
FunctionApp101.slnx - Press
F5to start debugging
Once running, test the HTTP endpoint:
curl http://localhost:7071/api/Function1Or open in your browser: http://localhost:7071/api/Function1
Expected response:
Welcome to Azure Functions!
- Ensure Azurite is running for local storage emulation
- Create a container named
source-containerin your storage - Upload a blob to
source-container - The function will automatically copy it to
destination-container
You can use Azure Storage Explorer or Azure CLI:
# Create containers (if using Azure Storage)
az storage container create --name source-container --connection-string "<your-connection-string>"
az storage container create --name destination-container --connection-string "<your-connection-string>"
# Upload a test file
az storage blob upload --container-name source-container --file test.txt --name test.txt --connection-string "<your-connection-string>"FunctionApp101/
βββ FunctionApp101.slnx # Solution file
βββ .gitignore # Git ignore rules
βββ README.md # This file
βββ LICENSE # MIT License
βββ FunctionApp101/ # Function App project
βββ Function1.cs # HTTP trigger function
βββ BlobCopyFunction.cs # Blob trigger with output binding
βββ Program.cs # Application entry point
βββ FunctionApp101.csproj # Project file
βββ host.json # Host configuration
βββ local.settings.json # Local settings (not in git)
Azure Functions is a serverless compute service that enables you to run event-triggered code without having to explicitly provision or manage infrastructure.
- HTTP Triggers: Functions that respond to HTTP requests
- Blob Triggers: Functions that respond to blob storage events
- Output Bindings: Declarative way to write data to external services
- Isolated Worker Model: Out-of-process execution model for better flexibility
- Dependency Injection: Using
ILoggerFactoryfor logging - Application Insights: Telemetry and monitoring integration
- Azure Functions Documentation
- .NET Isolated Worker Guide
- Azure Functions Core Tools
- Application Insights for Azure Functions
The host.json file contains global configuration options:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
}
}| Variable | Description |
|---|---|
AzureWebJobsStorage |
Connection string for Azure Storage |
FUNCTIONS_WORKER_RUNTIME |
Set to dotnet-isolated |
APPLICATIONINSIGHTS_CONNECTION_STRING |
Application Insights connection string |
- Create a resource group:
az group create --name rg-functionapp101 --location eastus- Create a storage account:
az storage account create --name stfunctionapp101 --location eastus --resource-group rg-functionapp101 --sku Standard_LRS- Create a function app:
az functionapp create --resource-group rg-functionapp101 --consumption-plan-location eastus --runtime dotnet-isolated --functions-version 4 --name functionapp101 --storage-account stfunctionapp101- Deploy the function:
func azure functionapp publish functionapp101- Right-click on the project in Solution Explorer
- Select Publish
- Choose Azure β Azure Function App (Windows)
- Follow the wizard to create or select a Function App
- Create a new
.csfile in the project - Add the function class with
[Function]attribute:
public class MyNewFunction
{
private readonly ILogger _logger;
public MyNewFunction(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.CreateLogger<MyNewFunction>();
}
[Function("MyNewFunction")]
public HttpResponseData Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req)
{
_logger.LogInformation("Processing request...");
var response = req.CreateResponse(HttpStatusCode.OK);
response.WriteString("Hello from MyNewFunction!");
return response;
}
}This project is licensed under the MIT License - see the LICENSE file for details.
Happy Coding! π
If you find this project helpful, please give it a β on GitHub!