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.
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:
Benefit | Description |
---|---|
Safer testing in production | Expose features to a limited audience before full rollout |
A/B testing | Compare variations to determine the best performing version |
Instant rollback | Disable a feature immediately—no code change or redeployment needed |
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.
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.
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.
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.
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
By abstracting connection details, you focus on application logic rather than configuration plumbing.
Setting Up Your Azure App Configuration Store
Follow these steps to spin up a configuration store and define your first feature flags:
- Sign in to the Azure Portal and select Create a resource.
- Search for App Configuration and click Create.
- Provide:
- Subscription & resource group
- A unique name
- Region (nearest your users)
- Pricing tier (Free tier available)
- Review and click Create.
- Open your store, navigate to Feature Management, and click Add.
- Enter a feature key, optional label, description, and rollout conditions.
- To apply filters (e.g., user percentage, custom attributes), select Feature Manager in the sidebar and add your rules.
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:
- Go to Access Control (IAM) in your resource.
- Click Add role assignment, choose roles like Contributor or Reader, and assign to users/groups.
- Optionally scope access at the label or key level.
Validate your configuration by retrieving feature flags in the portal or via code. Use Managed Identities or service principals for secure authentication.
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.
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.
Links and References
Watch Video
Watch video content