What Are Feature Flags?
Feature flags, also known as feature toggles, are a software development technique that allow developers to turn features of an application on or off without deploying new code. This approach enables safer testing in production, gradual feature rollouts, and quick response to issues by disabling problematic features without the need for immediate code changes or redeployments.
By using feature flags, teams can manage the visibility and operational status of various features across different environments directly from their configuration. This method provides more dynamic and flexible control over feature releases. It also reduces the risk associated with deploying new functionalities by providing a mechanism for quick rollback or adjustment.
In this article:
How Does Azure App Configuration Support Feature Flags?
Azure App Configuration is a managed service that provides a central place for managing application settings and feature flags. It simplifies the task of controlling how and when features are enabled in your application, offering a secure and scalable environment for configuration data.
This service supports a range of scenarios from simple application settings management to complex feature flag strategies that can vary across different environments or user segments. It integrates with Azure’s ecosystem, allowing developers to use feature flags in conjunction with Azure DevOps as part of their CI/CD workflow.
With Azure App Configuration, teams can manage feature toggles, experiment with new functionalities in production safely, and modify configurations without redeploying the application.
Tips From the Expert
In my experience, here are tips that can help you implement Azure Feature Flags effectively:
-
Establish a flag cleanup process
Regularly audit your feature flags to avoid accumulating technical debt. Implement a clear process for retiring or removing flags once they have served their purpose, especially short-lived toggles used for testing or experimentation. -
Use staged rollouts with metrics tracking
For production environments, use gradual rollouts by enabling feature flags for small user segments or specific regions first. Track metrics (like error rates and performance) to ensure stability before a full release. -
Leverage label filtering for better control
Use Azure App Configuration labels to isolate feature flags by environment (e.g., dev, test, production). This ensures that features being tested in development are not accidentally deployed to production, providing greater control over feature visibility. -
Combine with A/B testing tools
Integrate Azure feature flags with A/B testing frameworks (e.g., Azure Application Insights or third-party tools) to measure the impact of different flag states on user behavior and performance. This can guide data-driven decisions on whether to fully enable or disable features. -
Automate flag management in CI/CD pipelines
Integrate feature flag toggling directly into your CI/CD process using Azure DevOps or GitHub Actions. This ensures feature flags are updated or toggled automatically during deployments, reducing manual effort and potential errors.
Tutorial: Managing Feature Flags in Azure App Configuration
Here’s an overview of how to use Azure App Configuration to create and manage feature flags.
Step 1: Create a Feature Flag
To create a feature flag, open your Azure App Configuration store in the Azure portal. Choose Feature manager on the Operations menu and select Create, then choose Feature flag.
Source: Azure
Next, you will need to configure the feature flag. Under Create, fill out the following settings:
- Enable feature flag: Check this box to enable the feature flag upon creation.
- Feature flag name: Enter a unique name, such as “Beta”.
- Key: By default, this will match the feature flag name, but you can add a prefix or namespace to group your flags.
- Label: You can use this to create different flags for the same key, though it’s optional.
- Description: Optionally, add a description for the flag.
- Use feature filter: Leave this box unchecked unless you are setting up conditional feature flags.
Once all fields are filled, select Apply to create the feature flag.
Step 2: Add a Variant Feature Flag
To create a variant feature flag, go to your Azure App Configuration store in the Azure portal, and select Feature manager on the Operations menu, then Create, and then choose Variant feature flag (Preview).
Source: Azure
Configure the variant feature flag with the following settings:
- Enable feature flag: Check this box to enable the flag upon creation.
- Name: Enter a unique name, such as “Greeting”.
- Key: By default, this will match the feature flag name, but you can customize it with a prefix or namespace.
- Label: Optionally, use labels to differentiate flags with the same key.
- Description: Add a description if desired.
Next, move to the Variants tab and configure the variants:
- Variant name: Provide unique names for the variants, such as “Off” and “On”.
- Value: Assign values to each variant, which can be a string, number, boolean, or configuration object.
- Default variant: Choose the default variant that will be used when no specific variant is assigned.
In the Allocation tab, distribute traffic among the variants, ensuring the total adds up to 100%. You can choose to override by groups or users, and use a custom seed for consistent user experiences across multiple flags.
Finally, click Review + create to finalize the variant feature flag.
Step 3: Edit a Feature Flag
To edit a feature flag or variant feature flag, navigate to the Feature manager from the Operations menu. Locate the flag you wish to modify, and select the More actions option. Here, you can choose to edit the flag, lock or unlock it, create a label, update tags, review its history, or delete it.
Select Edit to update the flag’s settings. You can also change the state of the flag by toggling the Enabled option on or off.
Step 4: Manage Your Views
The Feature manager menu in Azure App Configuration displays all feature flags and variant feature flags that are stored in your configuration store. This provides a comprehensive overview of your flags, allowing you to manage and monitor their states.
To tailor this display to your preferences and requirements, you can customize the view by selecting Manage view on the Feature manager menu.
Source: Azure
In the Settings section of Manage view, you have the option to adjust how many feature flags are loaded per action. By default, the Load more action appears only if there are more than 200 feature flags. You can change this number to fit your workflow, making it easier to manage a large number of feature flags without overwhelming the interface.
The Edit Columns feature allows you to customize which columns are displayed in the Feature manager view. You can add or remove columns based on the information you find most useful, such as flag names, keys, labels, descriptions, and statuses. Additionally, you can reorder the columns to prioritize the data that is most important to you.
Pro Tips for Implementing Feature Flags in Azure
Here are some of the ways to ensure effective feature flag management in Azure.
1. Carefully Plan Your Feature Flags
When planning and designing feature flags, establish clear naming conventions and a structured approach for their lifecycle management. These naming conventions ensure that flags are easily identifiable, understandable, and manageable across different teams and environments.
Consider incorporating elements like feature name, environment, and versioning into the flag names to convey meaningful information at a glance. Additionally, define processes for creating, reviewing, and retiring feature flags to avoid clutter and potential technical debt. This includes setting criteria for when a flag should be removed or turned permanent in the codebase.
Categorize feature flags based on their purpose—such as release toggles, experiment toggles, or kill switches—and their expected lifespan. Short-lived flags used for A/B testing might require different management practices compared to long-term flags that control access to major features.
2. Keep Environment Configurations Separate
Segregate environment configurations to maintain separate settings for development, testing, and production environments. This ensures that changes made in one environment do not unintentionally impact another. For example, a feature flag enabled in the development environment should not automatically be enabled in production.
Azure App Configuration supports this through the use of labels that can differentiate configurations across environments. Separating configurations helps prevent common pitfalls such as premature exposure of features to end users or the accidental disruption of live services.
3. Implement Secure Access
Use Azure Active Directory (Azure AD) for authentication, ensuring that only authorized personnel can modify feature flags. This integrates with role-based access control (RBAC), allowing fine-grained permissions to be set for different team members. Assign roles such as Reader, Contributor, or Owner to match each user’s responsibilities.
In addition to RBAC, consider using Managed Identities for Azure resources when accessing App Configuration from your applications. This eliminates the need to store credentials in code or configuration files, reducing the risk of credential leaks.
4. Decouple Feature Flags from Feature Code
By isolating the logic that checks feature flag states from the business logic of your features, you create a more modular and easier-to-test application. This separation allows developers to add or modify feature flags without directly impacting the core functionality of the application, leading to safer deployments and a cleaner codebase.
You can achieve this decoupling using abstraction layers or services dedicated to managing feature flag checks. These can then be injected into parts of your application where feature toggles are needed.
Related content: Read our guide to feature flag management
Feature Flags with Configu
Configu is a configuration management platform comprised of two main components:
Configu Orchestrator
As applications become more dynamic and distributed in microservices architectures, configurations are getting more fragmented. They are saved as raw text that is spread across multiple stores, databases, files, git repositories, and third-party tools (a typical company will have five to ten different stores). Configu can work as a stand-alone platform or as an orchestrator for secrets managers, feature flags and other stores. It has built-in support for popular feature flag managers, such as Launch Darkly.
The Configu Orchestrator, which is open-source software, is a powerful standalone tool designed to address this challenge by providing configuration orchestration along with Configuration-as-Code (CaC) approach.
Configu Cloud
Configu Cloud is the most innovative store purpose-built for configurations, including environment variables, secrets, and feature flags. It is built based on the Configu configuration-as-code (CaC) approach and can model configurations and wrap them with unique layers, providing collaboration capabilities, visibility into configuration workflows, and security and compliance standardization.
Unlike legacy tools, which treat configurations as unstructured data or key-value pairs, Configu is leading the way with a Configuration-as-Code approach. By modeling configurations, they are treated as first-class citizens in the developers’ code. This makes our solution more robust and reliable and also enables Configu to provide more capabilities, such as visualization, a testing framework, and security abilities.