【问题标题】:is it possible to use Feature Management (feature flags) with Azure Functions?是否可以在 Azure Functions 中使用功能管理(功能标志)?
【发布时间】:2020-08-27 01:37:56
【问题描述】:

我一直在尝试将使用功能标志与 azure 函数一起使用,但我似乎无法正确获取配置。

有一些关于如何获取配置值的文档,但没有关于功能管理的文档。 https://docs.microsoft.com/en-us/azure/azure-app-configuration/use-feature-flags-dotnet-core

【问题讨论】:

    标签: azure azure-functions azure-app-configuration


    【解决方案1】:

    是的,有可能!

    ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
            configurationBuilder.AddAzureAppConfiguration(options =>
            {
                options.Connect(Environment.GetEnvironmentVariable("ConnectionString"))
                       // Load all keys that start with `TestApp:`
                       .Select("TestApp:*")
                       // Configure to reload configuration if the registered 'Sentinel' key is modified
                       .ConfigureRefresh(refreshOptions =>
                            refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true)
                        )
                       // Indicate to load feature flags
                       .UseFeatureFlags();
    

    参考:https://github.com/Azure/AppConfiguration/blob/master/examples/DotNetCore/AzureFunction/FunctionApp/Startup.cs

    您可以获得IFeatureManagerSnapshot 的实例并将其用作 Azure Functions 调用的一部分。

    参考: https://github.com/Azure/AppConfiguration/blob/master/examples/DotNetCore/AzureFunction/FunctionApp/Startup.cs

    其他参考:

    1. Usage of Azure App Configuration's Feature Flags in Azure Functions
    2. https://github.com/MicrosoftDocs/azure-docs/issues/52234

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-25
      • 2022-01-02
      • 2020-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-01
      相关资源
      最近更新 更多