Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.45 KB

File metadata and controls

42 lines (29 loc) · 1.45 KB

ASP.NET

Setup Azure Monitor/App Insights

Setup Application Insights to instrument telemetry into your application.

builder.Services.AddApplicationInsightsTelemetry();

Setup App Configuration

Connect your application to App Configuration, which supplies feature flags and other configurations to your application.

builder.Configuration.AddAzureAppConfiguration(options =>
{
    options.Connect(new Uri(endpoint), new DefaultAzureCredential());
});

Setup Feature Management

Add Feature Management to the service collection and add the targeting middleware. Learn More

builder.Services.AddFeatureManagement()
    .WithTargeting()
    .AddApplicationInsightsTelemetry();
 
app.UseMiddleware<TargetingHttpContextMiddleware>();

Use Feature Management

Use DI to retrieve the FeatureManager, and get the assigned variant of the feature flag for the user. Use DI to get an instance of FeatureManager for flag data and TelemetryClient for custom events.

Variant variant = await _featureManager
    .GetVariantAsync("MyFeatureFlag", HttpContext.RequestAborted);

telemetryClient.TrackEvent("checkout");