2

We are trying to create azure function app using .NET pre-compiled libraries (without .NET core) and all application configurations we have added in appsettings.json file that is working fine locally. We are able to get the key's value using below code

ConfigurationManager.AppSettings["keyName"]

But, after deployment using VS2017 we are not able to get the key's value from appsetting.json file unless we have to create configurations in Azure Application-setting blade manually.

We also tried to add configuration in Web.config but it didn't work and Azure-Functions: Can you use web.config restrictions (e.g. IP restriction or basic Auth) suggested that web.config is not supported to Azure Function app.

What is the best way to store application settings for Azure function app except Azure Application-setting blade?.

3
  • Did you try getting them as Environment Variables? Settings are being made available as Environment Variables in Azure Functions. Commented Jul 12, 2017 at 11:18
  • I believe Environment variables are used to get the app setting and connection string key's value from Azure application-setting blade not from appsettings.json. Please correct me if i'm wrong. Commented Jul 12, 2017 at 11:31
  • If it is useful, please mark it will help more communities who have the same issue. Commented Jul 27, 2017 at 7:54

1 Answer 1

2

In the VS 2017 Azure function project, using the file local.settings.json to stores app settings, connection strings, and settings for Azure Functions Core Tools. I also can repro the issue (no appsetting item in theApplication-setting blade) you mentioned when using that vs2017 to publish the project.

What is the best way to store application settings for Azure function app except Azure Application-setting blade?

We could use the Azure Functions Core Tools to do that easily. It works correctly on my side.

func azure functionapp publish azurefunctionname --publish-local-settings

The following is the detail steps:

1.create an Azure function project with VS2017 preview 2.0 and following content in the local.setting.json file

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "xxxxxxxx",
    "AzureWebJobsDashboard": "xxxxxxx",
    "Message": "Hello world!"
  }
}

2.install the Azure Functions Core Tools

3.switch to Azure function project directory

4.before run the cmd required azure login

5.publish the local settings to Azure appsettings

enter image description here

5.Check from Azure portal.

enter image description here

More detail about developing and test Azure function please refer to the official tutorials.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Tom for suggestion , we are using Azure Powershell and Cli commands to publish local settings defined in template and parameter json files to Azure application blade.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.