Manic Lama
Manic Lama

Reputation: 65

Do I need an Azure Storage Account to run a WebJob?

So I'm fairly new to working with Azure and there are some things I can't quite wrap my head around. One of them being the Azure Storage Account.

My web jobs keeps stopping with the following error "Unhandled Exception: System.InvalidOperationException: The account credentials for '[account_name]' are incorrect." Understanding the error however is not the problem, at least that's what I think. The problem lies in understanding why I need an Azure Storage Account to overcome it.

Please read on as I try to take you through the steps taken thus far. Hopefuly the real question will become more clear to you.

In my efforts to deploy a WebJob on Azure we have created the following resources so far:

I'm using the following code snippet to prevent my web job from exiting:

JobHostConfiguration config = new JobHostConfiguration();
config.DashboardConnectionString = null;
new JobHost(config).RunAndBlock();

To my understanding from other sources the Dashboard connection string is optional but the AzureWebJobsStorage connection string is required.

I tried setting the required connection string in portal using the configuration found here.

DefaultEndpointsProtocol=[http|https];AccountName=myAccountName;AccountKey=myAccountKey

Looking further I found this answer that clearly states where I would get the values needed, namely an/my missing Azure Storage Account.

So now for the actualy question: Why do I need an Azure Storage Account when I seemingly have all the resources I need place for the WebJob to run? What does it do? Is it a billing thing, cause I thought we had that defined in the App Service Plan. I've tried reading up on Azure Storage Accounts over here but I need a bit more help understanding how it relates to everything.

Upvotes: 4

Views: 8267

Answers (3)

Viswas Menon
Viswas Menon

Reputation: 310

The answer to your question is "No", it is not mandatory to use Azure Storage when you are trying to setup and run a Azure web job.

If you are using JobHost or JobHostConfiguration then there is indeed a dependency for Storage accounts.

Sample code snippet is give below.

class Program
{
    static void Main()
    {
        Functions.ExecuteTask();
    }

}

public class Functions
{
    [NoAutomaticTrigger]
    public static void ExecuteTask()
    {
        // Execute your task here 
    }
}

Upvotes: 2

lopezbertoni
lopezbertoni

Reputation: 3641

The answer is no, you don't. You can have a WebJob run without being tied to an Azure Storage Account. Like Murray mentioned, your WebJob dashboard does use a storage account to log data but that's completely independent.

Upvotes: 0

Murray Foxcroft
Murray Foxcroft

Reputation: 13795

From the docs:

An Azure storage account provides resources for storing queue and blob data in the cloud.

It's also used by the WebJobs SDK to store logging data for the dashboard.

Refer to the getting started guide and documentation for further information

Upvotes: 2

Related Questions