In this article, We learn how to get value from local.settings.json in Azure Function App.  I will show how to do it, and just follow the steps clearly.

For more updates please do Subscribe via Email:

What is local.settings.json?

local.settings.json is a json file inside the function app solution. In ASP.net Framework this might be a web.config and for dotnet core this is a appsettings.json. Anything is secret it will be located and put it here. like Database connection string or RestAPI keys and any sensitive information.

Impletementation

I added a new config setting name “CodeLifeBlogURL” with value of “https://codelife.javelupango.com/blog/“.

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "CodeLifeBlogURL": "https://codelife.javelupango.com/blog/"
  }
}

To pull the value from local.settings.json. you need to add this code in your application. Calling the environment variable and simplify the config name.

   var codeLifeURL = Environment.GetEnvironmentVariable("CodeLifeBlogURL"); 

Happy Learning..

Thank you for visiting my blog site. Hoping you learn more here. please feel free to comment and suggest if there is need to enhance and update. thank you.

Related Topics

Leave a Reply

Your email address will not be published. Required fields are marked *