Local settings, Azurite and Core Tools
Before deploying anything, you can run and debug a whole function app on your own computer. This lesson covers local.settings.json, Azurite as a local Storage account, and the Core Tools commands you will use every day.
- Your editor and debuggerVisual Studio, VS Code or Rider with breakpoints.
- Core Tools hostfunc start runs the Functions host on port 7071.
- local.settings.jsonSettings and connection names for this machine only.
- AzuriteLocal Blob, Queue and Table storage on ports 10000 to 10002.
Everything a function app needs can run on a laptop before it touches Azure.
local.settings.json
Locally, app settings come from local.settings.json under Values. In Azure, the same names are set as application settings on the function app. Code reads both the same way, through IConfiguration or environment variables.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"Storage": "UseDevelopmentStorage=true",
"OrdersQueue": "orders-local"
}
}Azurite: Storage on your machine
The runtime needs a Storage account (AzureWebJobsStorage), and queue, blob and timer triggers use one too. Azurite is Microsoft's local emulator for Blob, Queue and Table storage. UseDevelopmentStorage=true points at it.
Visual Studio starts Azurite for you. Otherwise run it with npm or Docker, and browse its contents with Azure Storage Explorer.
npm install -g azurite
azurite --silent --location ./.azurite
# or
docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azuriteEveryday Core Tools commands
- func start: build and run the app, listing every function and its local URL.
- func new: add a function from a template (HTTP trigger, Timer trigger, Queue trigger and more).
- func azure functionapp fetch-app-settings <app>: copy settings from Azure into local.settings.json (careful: these may be real secrets).
- func azure functionapp publish <app>: deploy from your machine; fine for learning, use CI for real apps.
Keep secrets out of Git
local.settings.json is in .gitignore by default; keep it that way. Share a local.settings.example.json with placeholder values instead.
Prefer emulators and your own Azure sign-in (DefaultAzureCredential) over copying production keys to laptops.
Interview question
How do you run and debug Azure Functions locally?
I run the app with Azure Functions Core Tools (func start) or F5 in Visual Studio. Settings come from local.settings.json, which is not committed, and Azurite emulates Azure Storage so queue, blob and timer triggers work offline. I keep business logic in injectable classes so I can unit-test it without the Functions runtime.
Want the full details? Read the official Microsoft documentation for this topic.