I am currently working on azure durable function.
My Deployment strategy is local kubernetes cluster.
Config files looks like this:
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"SQLDB_Connection": "Server=localhost,1433;Database=DurableDB;User Id=sa;Password=ungabunga@Qtpie;",
"KeyVaultUrl": "https://kvurl.vault.azure.net/"
}
}
host.json
{
"version": "2.0",
"extensions": {
"durableTask": {
"storageProvider": {
"type": "mssql",
"connectionStringName": "SQLDB_Connection",
"createDatabaseIfNotExists": true
}
}
},
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
}
}
I have a Program.cs in the root of the directory where i configure and run application as
var host = hostBuilder
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
var keyVaultUrl = Environment.GetEnvironmentVariable("KeyVaultUrl");
if (keyVaultUrl == null)
{
throw new InvalidConstraintException("KeyVaultUrl cannot be null");
}
services.ConfigureKeyVault(keyVaultUrl);
services.AddHttpClient();
})
.Build();
await host.RunAsync();
Is there any way that I can fetch sqldb connection string from kv and run the application? I am not able to find where the dependency is implemented and injected. SO on which function call on the hostBuilder i can invoke keyvault fetch changes and then initialize durable function db related dependencies manually and continue normal flow of the application.
Or my approach may be completely wrong and I should deploy this on Azure Portal itself. Please help me here. Dependencies are as below:
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask.SqlServer" Version="1.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.2" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0"/>
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0"/>




