I am trying to establish an Entity Framework database connection within my Azure function. Therefore I need to define a connection string in the application settings of the function. Just adding a connection string with my DbContext class name as key in Azure Portal leads to an exception as the providername attribute is undefined when connecting to the database. I am using Entity Framework v. 6.2.0
The Exception is:
System.InvalidOperationException: 'The connection string 'CloudOrchestrationEntities' in the application's configuration file does not contain the required providerName attribute."'
Is there a way to use a json string like the one I can define in local.settings.json in the application settings in Azure portal?
"ConnectionStrings": {
"CloudOrchestrationEntities": {
"ConnectionString": "metadata=res://*/CloudOrchestration.csdl|res://*/CloudOrchestration.ssdl|res://*/CloudOrchestration.msl;provider=System.Data.SqlClient;provider connection string='data source=*****.database.windows.net;initial catalog=*****;user id=*****;password=*****;MultipleActiveResultSets=True;App=EntityFramework'",
"ProviderName": "System.Data.EntityClient"
}
}
Using this json entry as connection string in Azure Portal including the provider name leads to an invalid connection string in my function code.
I surely can define the connection string as a usual app setting and retrieve it in my function code to connect to db but this is not the way I want this issue to be resolved. Actually I do not want to edit the auto generated EF classes as I share them with a different project.