This post was most recently updated on October 3rd, 2022.
2 min read.Another day, another issue with Azure Functions! For such a simple and powerful tool, it sure does produce a lot of topics for blog articles! đ So, in this article, Iâm explaining a couple of possible reasons why you might get an error along the lines of âMissing value for AzureWebJobsStorageâ when debugging Azure Functions locally.
But before jumping into the solution(s), letâs take a closer look at the issue at hand, shall we?
Problem
When firing up your Azure Functions project locally, this error is what youâre confronted with:
âMissing value for AzureWebJobsStorage in local.settings.json. This is required for all triggers other than httptrigger, kafkatrigger. You can run âfunc azure functionapp fetch-app-settings â or specify a connection string in local.settings.json.â
But⊠You might actually have that property in the file â so whatâs the error about, then? Letâs take a look!
What is âAzureWebJobsStorageâ property used for?
The Azure Functions runtime uses this storage account connection string for its normal operation. Some uses of this storage account include key management, timer trigger management, and Event Hubs checkpoints. The storage account in question must be a general-purpose one that supports blobs, queues, and tables.
However â when running the runtime locally, this property in your local.settings.json file under âValuesâ should usually contain âUseDevelopmentStorage=trueâ, in which case the runtime should use your Azure Storage Explorer or Azurite locally.
Solution
The solution might be one of the following â Iâm starting from the most obvious and simple one, which is likely where you should start as well.
Time needed:Â 10 minutes
4 ways to fix âMissing value for AzureWebJobsStorage in local.settings.jsonâ!
- First things first â add âAzureWebJobsStorageâ value to your local.settings.json file
Obviously, you could be missing this app setting completely â maybe by adding it somewhat like this:
And in copy-pasteable form â this is what you should add to local.settings.json -fileâs âValuesâ-node:"AzureWebJobsStorage": "UseDevelopmentStorage=true"
Simple as that! Except if it doesnât work, try the other options below. - Close and reopen your Visual Studio instance
Just in case â itâs worth trying out.
Itâs easy, itâs quick, and it has helped me once or twice! - No nested values in local.settings.json
Valid JSON can have values nested infinitely deep. But your local.settings.json file does not support that (beyond predefined âsectionsâ, such as âValuesâ (for app settings) or âConnectionStringsâ, however!
Verify youâre not trying anything too fancy there.
Whatâs a bit confusing, however, is that the appsettings.json file DOES support nested configuration values. So no consistency here. đ - Make sure your local.settings.json file is getting deployed (copied) to the output folder
Modify your .csproj file to have this:
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
This applies at least to .NET with recent versions of Visual Studio, but YMMV. đ
And at this point, you should be good!
Did it work for you? Am I missing something? Let me know in the comments section below!
References
- https://github.com/Azure/azure-functions-core-tools/issues/1473
- https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings#azurewebjobsstorage
- https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator
- How to manually install Windows updates? - November 28, 2023
- How to restore an old version of a Trello card? - November 21, 2023
- How to fix winget when itâs throwing a â0x8a15000f : Data required by the source is missingâ? - November 14, 2023