简体   繁体   English

Appsettings.json 等效于 Azure C# 功能

[英]Appsettings.json equivalent in Azure C# functions

I am creating an Azure C# function which will be deployed to different environments through pipeline.我正在创建一个 Azure C# function 将通过管道部署到不同的环境。 So I need to conveniently store settings parameters for each specific environment.所以我需要方便地存储每个特定环境的设置参数。

For example in Asp.Net Core there are appsettings.Development.json , appsettings.Production.json .例如在 Asp.Net Core 中有appsettings.Development.jsonappsettings.Production.json I am looking for something similar in Azure functions.我在 Azure 函数中寻找类似的东西。

Note: these settings should also go to source control.注意:这些设置也应该 go 到源代码控制。

Locally you obviously have local.settings.json for development settings, once you go to azure you'll need to create settings on the functions app service itself.在本地,你显然有 local.settings.json 用于开发设置,一旦你从 go 到 azure,你需要在功能应用服务本身上创建设置。 To do this in a source control friendly way to can use ARM templates, these allow you to create your function infrastructure which can include settings and their values.要以源代码控制友好的方式执行此操作,可以使用 ARM 模板,这些模板允许您创建 function 基础架构,其中可以包含设置及其值。 Because ARM templates are idempotent you're therefore able to simple add a setting or change its value and reapplying the template will only apply the change you made in the current release.由于 ARM 模板是幂等的,因此您可以简单地添加设置或更改其值,并且重新应用模板只会应用您在当前版本中所做的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM