In my Azure Function I am using a Library which establishes a connection to an SQL server via the ConnectionString from the ConfigurationManager like this:
v
Add file local.setting.json
{
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
"tenantId": "You tenantId",
"resource": "https://management.azure.com/",
"ClientSecret": "You ClientSecret, Key from App Registry",
"ClientId": "You ClientId, Application ID from App registry",
"subscriptionId": "You subscriptionId",
"resourceGroupName": "Your resourceGroupName",
"serverName": " Your SQL Server",
"databaseNameDW": "Your Database",
"apiversion": "2017-10-01-preview"
}
}
In C# Code use:
private readonly static string tenantId = ConfigurationManager.AppSettings["tenantId"];