Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the AzureWebJobsStorage & AzureWebJobsDashboard in .net core 2.0 webjobs #1367

Closed
mattwoberts opened this issue Oct 5, 2017 · 3 comments

Comments

@mattwoberts
Copy link

mattwoberts commented Oct 5, 2017

I've got a webjob, coded in .net core 2.0, that I'm deploying to azure.

I have AzureWebJobsStorage and AzureWebJobsDashboard defined as connection strings in my appsettings.json. In azure application settings for my web app, I define values for these 2 connection strings in the format:

DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=yyy;EndpointSuffix=core.windows.net

Additionally, in my webjob code, I ensure the environment variables are set correctly with:

Environment.SetEnvironmentVariable("AzureWebJobsStorage", configuration.GetConnectionString("AzureWebJobsStorage"));
Environment.SetEnvironmentVariable("AzureWebJobsDashboard", configuration.GetConnectionString("AzureWebJobsDashboard"));

When I deploy this webjob and try to run it, it won't start, and the error is:

Unhandled Exception: System.InvalidOperationException: Failed to validate Microsoft Azure WebJobs SDK Dashboard connection string. The Microsoft Azure Storage account connection string is not formatted correctly. Please visit https://go.microsoft.com/fwlink/?linkid=841340 for details about configuring Microsoft Azure Storage connection strings.

However if I then change my code so that my connection strings in my appsettings.json file and in azure's application settings are renamed to something else (e.g. WebJobsStorage and WebJobsDashboard), and then I set them accordingly:

Environment.SetEnvironmentVariable("AzureWebJobsStorage", configuration.GetConnectionString("WebJobsStorage"));
Environment.SetEnvironmentVariable("AzureWebJobsDashboard", configuration.GetConnectionString("WebJobsDashboard"));

Then, when I run these webjobs, they do run without error. But when I try to visit the WebJobs Dashboard, I see:

The configuration is not properly set for the Microsoft Azure WebJobs Dashboard. 
In your Microsoft Azure Website configuration you must set a connection string named AzureWebJobsDashboard by using the following format DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY pointing to the Microsoft Azure Storage account where the Microsoft Azure WebJobs Runtime logs are stored. 

I'm using the 3.0.0beta3 of the azure.webjobs.sdk.

Am I incorrectly configuring the webjobs, or is this a bug with the sdk?

@paulbatum paulbatum added this to the Active Questions milestone Oct 11, 2017
@paulbatum
Copy link
Member

Set them as app settings rather than connection strings and you shouldn't run into this.

@mattwoberts
Copy link
Author

Sorry, but that doesn't work.

I can set an app setting, rather than a connection string, but then when I try to navigate to the web jobs dashboard:

image

The only way I can get this working is to create duplicate connection strings - so I create my 2 connection strings AzureWebJobsStorage and AzureWebJobsDashboard, and then I need to create 2 other connection strings called something like WebJobsStorage and WebJobsDashboard, and then use those in my code via SetEnvironmentVariable

@mattwoberts
Copy link
Author

Played with this some more, and it turns out it's a duplicate of #1408 so I'm going to close this, cheers 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants