Azure / Azure/azure-functions-core-tools

Feature: Proposal: make azurite the default storage for local functions

Open
#3,176 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

Today most function templates require AzureWebJobsStorage to be set to a viable storage account, even if storage is not the trigger or binding you care about.

A lot of times (any trigger type other than HTTP) this results in the trial of an experience resulting in a runtime error. This is not a great experience and I'm willing to bet there is a lot of usage drop off based on this.
```console
paulyuk@Pauls-MBP-2  ~/src/functions/justworks  func init
paulyuk@Pauls-MBP-2  ~/src/functions/justworks  func new --template 'Timer trigger' --name timertrigger
paulyuk@Pauls-MBP-2  ~/src/functions/justworks  func start
Found Python version 3.9.6 (python3).

Azure Functions Core Tools
Core Tools Version: 4.0.4829 Commit hash: N/A (64-bit)
Function Runtime Version: 4.11.2.19273

[2022-10-20T00:22:56.306Z] The listener for function 'Functions.TimerTrigger' was unable to start.
[2022-10-20T00:22:56.309Z] The listener for function 'Functions.TimerTrigger' was unable to start. Microsoft.Azure.WebJobs.Extensions.Timers.Storage: Could not create BlobContainerClient for ScheduleMonitor.
```

I propose we make common default cases to "just work". Back when I worked on function tools for VS we had a similiar theory and saw good results making the F5 scenario just work thanks to functions core tools and Azure Storage Emulator always being there and ready to launch.

The key parts of the proposal are:
- Functions CLI / core tools takes a soft dependency on Azurite, we either include it by default in our installer or we chain install on demand
- Templates should automatically set ` "AzureWebJobsStorage": "UseDevelopmentStorage=true"` in local.settings.json
- If the AzureWebJobsStorage is not set, again set it to use the emalutor
- If it is set, the user knows what they are doing and we leave it alone
- In VS Code, provide a prominent option to set Azurite emaluator as local storage, adjacent to Azure Storage Accounts options in the cloud. This might need a separate proposal and issue.
- If the users hit the null Storage account issue, put a friendlier error message to read an aka.ms link and point to the doc on Azurite for functions: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio
- as users deploy and go "code to cloud" we of course need to guide them to use a real storage account, and perhaps by default we make that a no brainer and just give them one unless they set it.

Contributor guide

Open the contributing guide

Research direction

Start with the Functions CLI/Core Tools behavior around templates, local.settings.json, installer dependencies, and the missing-storage error described in the proposal. Review how these entry points currently handle AzureWebJobsStorage and Azurite, then determine how the requested defaults, installation behavior, and friendlier guidance would be covered. Done means the agreed scope is implemented and the common local function scenarios work without a real storage account.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
cli, cloud, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.