Not able to set AzureWebJobsDashboard and AzureWebJobsStorage from KeyVault
See original GitHub issueDescription
I want to set the connection string for AzureWebJobsStorage from Key Vault instead of picking from appSettings.json > connectionStrings > AzureWebJobsStorage.
I don’t want to load this from Azure Cloud Configuration either.
Repro steps
I tried using the InMemory configuration and Environment.SetEnvironmentVariable to provide the connection strings as below:
- InMemory configuration
var builder = new HostBuilder() `` .ConfigureHostConfiguration(b => { b.AddInMemoryCollection(new Dictionary<string, string> { { “ConnectionStrings:AzureWebJobsDashboard”, storageConnString}, { “ConnectionStrings:AzureWebJobsStorage”, storageConnString}, }); })
2. Setting Environment Variable
Environment.SetEnvironmentVariable(“AzureWebJobsDashboard”, storageConnString); Environment.SetEnvironmentVariable(“AzureWebJobsStorage”, storageConnString);
#### Actual behavior
I get the following error if I do not add the config key "AzureWebJobsDashboard" in appSettings.json, or set it as empty/null.
`ArgumentNullException: Value cannot be null. (Parameter 'connectionString')`
Provide any related information
* Package version
* Links to source
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top GitHub Comments
Yes,I used the solution by @mohsinonxrm above.
Looks neat!
Get Outlook for Androidhttps://aka.ms/ghei36
From: mohsinonxrm notifications@github.com Sent: Thursday, October 22, 2020 7:34:41 AM To: Azure/azure-webjobs-sdk azure-webjobs-sdk@noreply.github.com Cc: Abhishek Kumar Mishra Abhishek.Mishra@microsoft.com; Mention mention@noreply.github.com Subject: Re: [Azure/azure-webjobs-sdk] Not able to set AzureWebJobsDashboard and AzureWebJobsStorage from KeyVault (#2523)
@abmis-mihttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fabmis-mi&data=04|01|Abhishek.Mishra%40microsoft.com|f18572cca84444da2fc908d8762ed70e|72f988bf86f141af91ab2d7cd011db47|0|0|637389290843047108|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=5hLuQgcaqwBIefWXXma5xskcX0YVDoV0PX1VHoGTUW4%3D&reserved=0 , here’s how I got it to work `builder.ConfigureHostConfiguration(configuration => { configuration.AddJsonFile(“appsettings.json”, false); var builtConfig = configuration.Build();
That’s it!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-webjobs-sdk%2Fissues%2F2523%23issuecomment-714174280&data=04|01|Abhishek.Mishra%40microsoft.com|f18572cca84444da2fc908d8762ed70e|72f988bf86f141af91ab2d7cd011db47|0|0|637389290843057043|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=JFl%2B0DOCPXpSWxQyifXYrDZ7aj57K5h3p3oGEl%2FOn%2B0%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPXYRWVOGVV2REAMUUJSV5LSL6HLTANCNFSM4OCYF3NQ&data=04|01|Abhishek.Mishra%40microsoft.com|f18572cca84444da2fc908d8762ed70e|72f988bf86f141af91ab2d7cd011db47|0|0|637389290843057043|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=XptNVckma4FzWnwzl1PWutcj3HEvT0YR1lzQsMlkOvY%3D&reserved=0.