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

August 30, 2026 3 answers
Asked by MellowCedar42
I'm still getting familiar with Azure Storage and need a simple, reliable way to save a variable's state between WebJob executions. I initially tried writing the value to a local file, but the process environment doesn't allow that. Should I use Blob Storage, Table Storage, or another Azure service?

Answers

QuartzHarbor7
For a single value, Blob Storage is probably the simplest option. Your WebJob can connect using the AzureWebJobsStorage connection string, load the current value when it starts, and save the updated value when it finishes. If you have several structured fields or many records, Table Storage is a better fit. A small state-store wrapper can keep the storage code clean.

MellowCedar42: Thanks, that clears things up. I’ll start with Blob Storage and use a small wrapper to load and save the value.

Reply to this answer
CopperWillow18
Blob Storage or Table Storage can both work, depending on the data shape. Also consider Durable Functions if this is a long-running or asynchronous workflow, since they provide built-in patterns for tracking execution state instead of managing it manually.
Reply to this answer
BrightLynx63
It’s worth reconsidering whether a WebJob is the right host for a long-running process. Depending on how the job runs and how much state it needs, another Azure compute option or Durable Functions may be a better fit. Either way, don’t rely on the local file system for persistent state because the instance can be restarted or replaced.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions