AZ-400: Designing and Implementing Microsoft DevOps Solutions

Design and Implement Deployments

Implement feature flags by using Azure App Configuration Feature Manager

Feature flags (also known as feature toggles) act as in-code switches to turn features on or off without redeploying. With Azure App Configuration Feature Manager, you can centralize these flags, target specific user segments, and manage your release cadence dynamically.

The image illustrates the concept of feature flags, showing how developers can enable or disable features for different user groups in a software application. It includes a visual representation of a new feature with toggle switches indicating on or off states for various users.

Why Use Feature Flags?

Feature flags empower teams to test in production, run A/B experiments, and rollback instantly if issues arise. The table below highlights key benefits:

BenefitDescription
Safer testing in productionExpose features to a limited audience before full rollout
A/B testingCompare variations to determine the best performing version
Instant rollbackDisable a feature immediately—no code change or redeployment needed

The image illustrates three benefits of feature flags: safer testing in production, A/B testing, and easier rollback, each represented by a distinct icon.

Azure App Configuration Overview

Azure App Configuration provides a centralized store for application settings and feature flags. Instead of embedding values in code, your app reads these settings at runtime, and changes propagate instantly.

The image is about Azure App Configuration for Feature Management, highlighting its benefits of avoiding hard-coding values and supporting dynamic changes.

Integration with Azure DevOps

Treat your configuration as code by integrating Azure App Configuration with Azure DevOps pipelines. Automate updates, version control your settings, and streamline deployment workflows.

The image illustrates the integration of Azure App Configurations and the Azure Ecosystem with DevOps practices for feature management. It shows a flow from Azure services to a DevOps infinity loop, highlighting stages like code, build, test, release, deploy, operate, and monitor.

Core Concepts of Feature Management

Decouple feature releases from application deployments. With dynamic feature flags, you can target users by environment, geography, or custom filters to roll out changes gradually.

The image illustrates "Feature Management" with a graphic of a code editor and a note stating "Decouples feature release from code deployment."

Feature Manager Library (Azure SDK)

The Feature Manager Library simplifies communication with Azure App Configuration. It handles flag retrieval, runtime evaluation, and integrates seamlessly into .NET applications.

The image illustrates the use of the Feature Manager Library in Azure, showing its connection with Azure App Configurations and the Azure SDK to manage feature flags.

With this library you can:

  • Retrieve feature flags and evaluate their status
  • Control rollout rules and conditional filters
  • Embed feature checks idiomatically in your code

The image illustrates the use of the Feature Manager Library in Azure, highlighting three aspects: retrieving feature flags, integrating feature flags into .NET applications, and managing feature flag states.

By abstracting connection details, you focus on application logic rather than configuration plumbing.

The image illustrates the use of the Feature Manager Library in Azure, highlighting its role in abstracting complex configurations and simplifying feature toggle management.

Setting Up Your Azure App Configuration Store

Follow these steps to spin up a configuration store and define your first feature flags:

  1. Sign in to the Azure Portal and select Create a resource.
  2. Search for App Configuration and click Create.
  3. Provide:
    • Subscription & resource group
    • A unique name
    • Region (nearest your users)
    • Pricing tier (Free tier available)
  4. Review and click Create.

The image is a step-by-step guide for configuring Azure App Configuration for feature flags, including logging into the Azure Portal and creating a new app configuration store.

  1. Open your store, navigate to Feature Management, and click Add.
  2. Enter a feature key, optional label, description, and rollout conditions.

The image is a guide for configuring Azure App Configuration for feature flags, detailing steps like choosing a subscription, resource group, name, region, and pricing tier.

  1. To apply filters (e.g., user percentage, custom attributes), select Feature Manager in the sidebar and add your rules.

The image is a step-by-step guide for configuring Azure App Configuration for feature flags, detailing actions like deploying resources, selecting "Feature Manager," and adding feature flags.

Note

You can combine multiple filters—such as time windows, user targets, or custom conditions—to roll out features safely.

Configuring Access Control

Secure your configuration store with Azure RBAC:

  1. Go to Access Control (IAM) in your resource.
  2. Click Add role assignment, choose roles like Contributor or Reader, and assign to users/groups.
  3. Optionally scope access at the label or key level.

The image provides instructions for configuring access control in Azure App Configuration for feature flags, detailing steps to navigate to "Access control (IAM)," add role assignments, and select roles for users or groups.

Validate your configuration by retrieving feature flags in the portal or via code. Use Managed Identities or service principals for secure authentication.

The image is a guide for configuring Azure App Configuration for feature flags, highlighting the validation step and mentioning Azure Managed Identities and Role-Based Access Control (RBAC).

Implementing Feature Flags in .NET Code

Install the NuGet packages and configure services:

// 1. ConfigureServices in Startup.cs
public void ConfigureServices(IServiceCollection services)
{
    services.AddAzureAppConfiguration();
    services.AddFeatureManagement();
}

Create a service to evaluate flags:

// 2. FeatureService.cs
using Microsoft.FeatureManagement;

public class FeatureService
{
    private readonly IFeatureManager _featureManager;

    public FeatureService(IFeatureManager featureManager)
    {
        _featureManager = featureManager;
    }

    public async Task<bool> IsEnabledAsync(string featureName)
    {
        return await _featureManager.IsEnabledAsync(featureName);
    }
}

Use it in a controller to conditionally render views:

// 3. HomeController.cs
public class HomeController : Controller
{
    private readonly FeatureService _featureService;

    public HomeController(FeatureService featureService)
    {
        _featureService = featureService;
    }

    public async Task<IActionResult> Index()
    {
        if (await _featureService.IsEnabledAsync("BetaFeature"))
            return View("BetaFeatureView");
        return View("StandardView");
    }
}

Monitor flag usage and application metrics with Azure Monitor for insights and health checks.

The image is a presentation slide titled "Leveraging Feature Flags for Agile Development," highlighting the importance of feature flags in software development, the role of Azure App Configuration, and the benefits of implementing feature flags.

Conclusion

Implementing feature flags with Azure App Configuration Feature Manager ensures your releases are flexible, safe, and data-driven. Centralize your toggles, automate rollouts, and react to user feedback instantly—no redeployments required.

Watch Video

Watch video content

Previous
Implementing Load Balancer Traffic Manager Releases and Web Apps