{"id":22300090,"url":"https://github.com/misinformeddna/azurefunctions.aspnetconfiguration","last_synced_at":"2025-03-25T23:21:09.964Z","repository":{"id":69906668,"uuid":"197456864","full_name":"MisinformedDNA/AzureFunctions.AspNetConfiguration","owner":"MisinformedDNA","description":"Adds ASP.NET Core Configuration capabilities to Azure Functions","archived":false,"fork":false,"pushed_at":"2020-07-14T19:04:07.000Z","size":41,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T20:38:57.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MisinformedDNA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-17T20:19:34.000Z","updated_at":"2020-11-24T16:14:39.000Z","dependencies_parsed_at":"2023-03-07T13:30:37.630Z","dependency_job_id":null,"html_url":"https://github.com/MisinformedDNA/AzureFunctions.AspNetConfiguration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisinformedDNA%2FAzureFunctions.AspNetConfiguration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisinformedDNA%2FAzureFunctions.AspNetConfiguration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisinformedDNA%2FAzureFunctions.AspNetConfiguration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisinformedDNA%2FAzureFunctions.AspNetConfiguration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MisinformedDNA","download_url":"https://codeload.github.com/MisinformedDNA/AzureFunctions.AspNetConfiguration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245557670,"owners_count":20635022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T18:09:07.546Z","updated_at":"2025-03-25T23:21:09.957Z","avatar_url":"https://github.com/MisinformedDNA.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AzureFunctions.AspNetConfiguration\nAdds ASP.NET Core Configuration capabilities to Azure Functions\n\nAzure Functions typically relies on local.settings.json and Azure environment variables for appsettings. \nIf you are here, you want an experience similar to ASP.NET.\n\n[![Build Status](https://dev.azure.com/yellowcounter/GitHub/_apis/build/status/AzureFunctions.AspNetConfiguration?branchName=master)](https://dev.azure.com/yellowcounter/GitHub/_build/latest?definitionId=26\u0026branchName=master)\n\n[![Nuget](https://img.shields.io/nuget/v/AzureFunctions.AspNetConfiguration)](https://www.nuget.org/packages/AzureFunctions.AspNetConfiguration/)\n\n## Configure\n\nTo configure this plugin, add a NuGet reference to [AzureFunctions.AspNetConfiguration](https://www.nuget.org/packages/AzureFunctions.AspNetConfiguration/)\nand then add `builder.UseAspNetConfiguration()` to Startup.cs, like:\n\n```csharp\nusing Microsoft.Azure.Functions.Extensions.DependencyInjection;\nusing YellowCounter.AzureFunctions.AspNetConfiguration;\n\n[assembly: FunctionsStartup(typeof(SampleFunctionApp.Startup))]\nnamespace SampleFunctionApp\n{\n    public class Startup : FunctionsStartup\n    {\n        public override void Configure(IFunctionsHostBuilder builder)\n        {\n            builder.UseAspNetConfiguration();\n        }\n    }\n}\n```\n\n## Complex objects\nUnlike local.settings.json, appsettings.json supports complex/sectioned settings such as\n\n```json\n{\n  \"section\": {\n    \"hello\": \"world\"\n  },\n}\n```\n\nThey are retrieved via standard means, as one would expect.\n\n## Configuration Hierarchy\nThe configuration added ASP.NET configuration *on top* of the default Azure Functions configuration settings. So we get this hierarchy:\n\n1. local.settings.json (by default)\n2. Environment variables (by default)\n3. appsettings.json\n4. appsettings.{EnvironmentName}.json\n  - EnvironmentName is pulled from the value if `AZURE_FUNCTIONS_ENVIRONMENT`\n    - In Visual Studio, this value defaults to 'Development'\n    - In Azure, this value defaults to 'Production'\n    - I'm [following up](https://github.com/MicrosoftDocs/azure-docs/issues/36045#issuecomment-517383100) to determine how to best override this value locally.\n    - You can override using `ASPNETCORE_ENVIRONMENT`, but it is [not recommended](https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings#azure_functions_environment)\n5. User Secrets, if `AZURE_FUNCTIONS_ENVIRONMENT` is set to 'Development'\n6. Environment variables (again, to give it the highest priority)\n\n## Extend\nIf you would like to use other ASP.NET config providers, you can add others to the end (and thus give them  highest priority), for example:\n\n```csharp\nvar settings = new Dictionary\u003cstring, string\u003e\n{\n    { \"setting5\", \"memory\" }\n};\nbuilder.UseAspNetConfiguration(c =\u003e c.AddInMemoryCollection(settings).AddEnvironmentVariables());\n```\n\n## Retrieve configuration\nIn order to retrieve the configuration settings themselves, you can use:\n\n```csharp\nvar configuration = builder.GetConfiguration();\nvar value = configuration[\"setting1\"];\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisinformeddna%2Fazurefunctions.aspnetconfiguration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmisinformeddna%2Fazurefunctions.aspnetconfiguration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisinformeddna%2Fazurefunctions.aspnetconfiguration/lists"}