Trouble Retrieving Feature Flag Configuration Setting: Getting a "404 Not Found" Error

Shree 0 Reputation points
2024-04-23T05:59:26.1766667+00:00

Hello,

I'm encountering an issue while trying to retrieve a configuration setting using the following code:

Response<ConfigurationSetting> response = client.GetConfigurationSetting(FeatureFlagConfigurationSetting.KeyPrefix + "DisplayButton");

if (response.Value is FeatureFlagConfigurationSetting featureFlag)

{

Console.WriteLine($"Feature flag {featureFlag.FeatureId} IsEnabled: {featureFlag.IsEnabled}");

ssResponse = featureFlag.IsEnabled.ToString();

}

However, I'm consistently getting a "Service request failed. Status: 404 (Not Found)" error. I've double-checked the configuration setting key and verified that the service is running and available.

Could someone please provide guidance on what might be causing this error and how I can resolve it? Any help would be greatly appreciated.

Thank you!

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
208 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 17,636 Reputation points
    2024-05-02T11:28:20.9133333+00:00

    @Shree Thanks for reaching out. I am bit confused by your requirement. According to the information provided, you have mentioned that you are trying to retrieve configuration setting but the code you are using is not for configuration setting, it's for retrieving feature flags.

    Here is sample code reference for retrieving for configuration values and feature flags.

    using System;
    using Azure.Data.AppConfiguration;
    using Azure;
    
    namespace FeatureFlagApp
    {
        class Program
        {
            static void Main(string[] args)
            {
                var client = new ConfigurationClient("Endpoint=https://myappconfig.azconfig.io;Id=xxxxx;Secret=xxxxx");
    
                // Create a new configuration setting 
                var setting = new ConfigurationSetting("some_key", "some_value");
                client.SetConfigurationSetting(setting);
    
                // Retrieve the configuration setting
                var key = client.GetConfigurationSetting("some_key");
                Console.WriteLine(key.Value);
    
                // Create a new feature flag configuration setting
                var featureFlagSetting = new FeatureFlagConfigurationSetting("feature_id", isEnabled: true);
                client.SetConfigurationSetting(featureFlagSetting);
    
                // Retrieve the feature flag configuration setting
    
                Response<ConfigurationSetting> response = client.GetConfigurationSetting(FeatureFlagConfigurationSetting.KeyPrefix + "feature_id");
                if (response.Value is FeatureFlagConfigurationSetting featureFlag)
                {
                    Console.WriteLine($"Feature flag {featureFlag.FeatureId} IsEnabled: {featureFlag.IsEnabled}");
                }
    
    
            }
        }
    }
    
    
    
    0 comments No comments