question

GuyBerman-8575 avatar image
0 Votes"
GuyBerman-8575 asked ryanchill commented

azure web jobs dashboard is not working when configuring storage connection strings from code

Hey, I am from Azure Monitor team.
Our service is built on top of Azure Web app (API + Web jobs).
So far we configuere AzureWebJobsDashboard & AzureWebJobsStorage in app settings, by deploying them as connection strings settings of the web app, or setting them directly in app settings, and it worked. Means, we were able to see web jobs logs in the Microsoft Azure WebJobs.
Now, since we are trying to avoid secret maintanance, we are trying to configuere those connection strings from JobHostConfiguration, setting the 'StorageConnectionString' & 'DashboardConnectionString' properties with the connection strings, as explained in several docs.
When doing this, we are unable to see the web jobs dashbloard anymore. To be more accurate -
If we remove the 'AzureWebJobsDashboard' & 'AzureWebJobsStorage' app settings and settings the connection string from code in the JobHostConfiguration object, the webjobs dashboard experience is broken and we see the following error:

Make sure that you are setting a connection string named AzureWebJobsDashboard in your Microsoft Azure Website configuration 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.

Please visit the article about configuring connection strings for more information on how you can configure connection strings in your Microsoft Azure Website.

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.

Please visit the article about configuring connection strings for more information on how you can configure connection strings in your Microsoft Azure Website.

Any idea how can we solve this without settings those connection strings in the app settings? is it an SDK issue?

SDK version: Microsoft.Azure.WebJobs 2.3.0

The code of setting up the JobHostConfiguration

public static JobHost CreateDefaultServiceBusJobHost(ITracer tracer,
                                                     Dictionary<string, string> queueLogicalToActualNames,
                                                     string serviceBusConnectionString,
                                                     string logsStorageAccountConnectionString,
                                                     int maxConcurrentCalls,
                                                     bool shouldUseTimers = false)
{
    if (_tracer != null)
    {
        throw new InvalidOperationException("Cannot create JobHost twice in the same process");
    }

    _tracer = tracer;

    JobHostConfiguration hostConfig = new JobHostConfiguration
    {
        // Add a name resolver so that queue name can be set from configuration
        NameResolver = new QueueNameResolver(queueLogicalToActualNames),
        StorageClientFactory = new ReliableStorageClientFactory(),
        StorageConnectionString = logsStorageAccountConnectionString,
        DashboardConnectionString = logsStorageAccountConnectionString
    };

    ServiceBusConfiguration serviceBusConfig = new ServiceBusConfiguration
    {
        ConnectionString = serviceBusConnectionString,
        MessageOptions = new OnMessageOptions
        {
            AutoComplete = true,
            AutoRenewTimeout = TimeSpan.FromMinutes(25),
            MaxConcurrentCalls = maxConcurrentCalls
        }
    };
    serviceBusConfig.MessageOptions.ExceptionReceived += OnExceptionReceived;

    // Add a custom messaging provider for wrapping the MessageProcessor class with traces
    serviceBusConfig.MessagingProvider = new CustomMessagingProvider(serviceBusConfig, _tracer);

    hostConfig.UseServiceBus(serviceBusConfig);
    if (shouldUseTimers)
    {
        hostConfig.UseTimers();
    }

    // add core extension registration for enabling binding of the ExecutionContext
    hostConfig.UseCore();

    var host = new JobHost(hostConfig);

    return host;
}


would appriciate any help

azure-webapps-developmentazure-webapps-webjobs
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered ryanchill commented

@GuyBerman-8575, If you're using 2.x, there shouldn't be any issues.

If you set logsStorageAccountConnectionString to UseDevelopmentStorage=true, does it still not save?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@GuyBerman-8575 wanted to follow up to see if you still running into issues.

0 Votes 0 ·