What’s the best way to persist a variable between Azure WebJob runs?

August 29, 2026 3 answers
Asked by MellowPine42
I'm still getting familiar with Azure Storage and need a simple, reliable way to save a variable's state so it can be loaded the next time an Azure WebJob runs. I initially tried writing the value to a local file from the process, but the environment doesn't allow that. Should I use Blob Storage, Table Storage, or another Azure service?

Answers

JuniperFox19
Blob Storage works well for one small piece of state. If you need several structured fields, multiple records, or to query values, Azure Table Storage is usually a better fit. It gives you a simple key-value style data store without requiring a full database.
Reply to this answer
CobaltRaven7
For a single value, Blob Storage is probably the simplest option. Your WebJob can read the state from a blob when it starts and write the updated value when it finishes. For example, you could use the connection string from the AzureWebJobsStorage environment variable, load the current value, do the work, and then save the new value. Local files aren’t reliable for WebJobs because the filesystem may be restricted or temporary.

MellowPine42: Thank you so much! That clears up why the file-based approach wasn’t working.

Reply to this answer
SilverKite63
If this is a long-running or asynchronous workflow rather than a simple scheduled job, Durable Functions may be worth considering. They provide built-in patterns for checkpoints and persisted orchestration state. For a basic WebJob variable, though, Blob or Table Storage should be enough.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions