I am using an Azure Function I created with VS Code and added an external dependency (it's a Class Library created in VS 2022 *.dll). The External dependency requires me to have a connection string to an Azure SQL Server to work accordingly. I want it, to run locally to determine the outcome of the process, but I am unable to do it so.
I have added the dependency in the *.csproj as:
<ItemGroup>
<Reference Include="HostServiceClassLib">
<HintPath>..\..\..\..\..\..\HostServiceClassLib.dll</HintPath>
</Reference>
</ItemGroup>
What I did so far,
In many places from VS Code, I added the settings namely JksbMsSqlConnection. Thus, so far included the following locations.
- Folder >
local.Settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
},
"ConnectionStrings": {
"JksbMsSqlConnection": "xxxxxxxxxxxx"
}
}
- Folder > vscode >
settings.json
{
"azureFunctions.deploySubpath": "bin/Release/net6.0/publish",
"azureFunctions.projectLanguage": "C#",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.preDeployTask": "publish (functions)",
"JksbMsSqlConnection": "xxxxxx"
}
- Folder > Properties >
launchSettings.json
{
"profiles": {
"CDSFileComposerFunc": {
"commandName": "Project",
"commandLineArgs": "--port xxx",
"launchBrowser": false,
"environmentVariables": {
"JksbMsSqlConnection": "xxxxxx"
}
}
}
}
I even added the prefix as SQLAZURECONNSTR_ but still no luck in all places above.
However, if I deploy to Azure and have the Settings under Azure Function > Configuration > Connection String it works!
My question is, for me to run it locally where do I need to place this connection string set? and what extra settings do I need to do?
Thank You,

