Azure DevOps Feature Flags: An ASP.NET Core Release Guide

By HU Beau

Use Azure DevOps to build, test, and deploy your application; use a feature flag service to decide which users receive a feature after deployment. For an ASP.NET Core application, FeatBit's server SDK evaluates flags for a stable user identity. A runtime flag change can restore the existing code path without rerunning the deployment pipeline, provided that path remains available.

This walkthrough adds a small release demonstration to an ASP.NET Core app. It uses FeatBit as the flag provider; Azure Pipelines remains the delivery system. The code is based on the official .NET server SDK, rather than a fictional Azure DevOps feature flag API.

Decide Which System Owns Each Step

Responsibility Owner What to verify
Source review and automated tests Azure Repos or your Git provider plus Azure Pipelines The candidate and existing implementations both pass
Deploying the application package Your Azure DevOps deployment job The application starts and its normal health checks pass
Selecting release audiences FeatBit targeting and SDK evaluation A stable identity receives the intended variation
Expanding or reversing exposure Release owner using FeatBit A measured rollout and a retained recovery path

Azure DevOps rollout approvals and feature flag targeting serve different decisions. An approved deployment can still start with the new behavior disabled. Feature flags also do not grant application permissions: authentication and authorization stay in your application.

1. Prepare the Flag and Environment

Create a boolean flag named catalog-v2 in your FeatBit environment. Use false for the existing implementation and true for the candidate. Begin with the existing behavior for all users, then target a small internal test audience.

Obtain the server environment secret, streaming URL, and event URL from your deployment's SDK setup. Follow the SDK configuration FAQ. Keep the secret in your runtime secret configuration and use separate FeatBit environments for staging and production.

For a private deployment, start with the Docker Compose installation guide. Review the self-hosted operating model before selecting a production topology.

2. Add a Single Server SDK Client

Install the SDK in an ASP.NET Core application:

dotnet add package FeatBit.ServerSdk

The following Program.cs keeps one client for the process lifetime and closes it on shutdown. Configure these runtime values:

FeatBit__EnvironmentSecret=<server-environment-secret>
FeatBit__StreamingUri=wss://your-evaluation-host
FeatBit__EventsUri=https://your-evaluation-host

Use the endpoint URLs from your own FeatBit setup. The client secret belongs on the server, and should not appear in browser JavaScript, pipeline output, or a committed configuration file.

using FeatBit.Sdk.Server;
using FeatBit.Sdk.Server.Model;
using FeatBit.Sdk.Server.Options;

var builder = WebApplication.CreateBuilder(args);
string Required(string key) => builder.Configuration[key]
    ?? throw new InvalidOperationException($"Missing configuration: {key}");

var options = new FbOptionsBuilder(Required("FeatBit:EnvironmentSecret"))
    .Streaming(new Uri(Required("FeatBit:StreamingUri")))
    .Event(new Uri(Required("FeatBit:EventsUri")))
    .Build();
var flags = new FbClient(options);
builder.Services.AddSingleton(flags);

var app = builder.Build();
if (!flags.Initialized)
    app.Logger.LogWarning("Flag initialization failed; the existing path will remain the fallback.");

app.MapGet("/release-demo/{sampleUserId}", (string sampleUserId, FbClient client) =>
{
    var user = FbUser.Builder(sampleUserId).Build();
    var enabled = client.BoolVariation("catalog-v2", user, defaultValue: false);
    return Results.Ok(new { implementation = enabled ? "candidate" : "existing" });
});

try
{
    await app.RunAsync();
}
finally
{
    await flags.CloseAsync();
}

The route is a demonstration using synthetic user IDs. In a production endpoint, build the context from a trusted account or authenticated user identifier, and put the actual candidate and existing implementations behind the evaluation. Keep the identity stable across requests; a new random key on every request changes assignment behavior.

The example's false fallback is appropriate because it preserves this application's existing behavior. Choose a fallback for each feature rather than treating false as a universal safety policy. Read the server SDK README for initialization, evaluation details, and lifecycle behavior.

3. Build and Publish Through Azure Pipelines

A small build pipeline can test and publish the application package independently of release exposure:

trigger:
  - main

pool:
  vmImage: ubuntu-latest

steps:
  - task: UseDotNet@2
    inputs:
      packageType: sdk
      version: '10.0.x'

  - script: dotnet restore
    displayName: Restore dependencies

  - script: dotnet test --configuration Release --no-restore
    displayName: Run automated tests

  - script: dotnet publish src/WebApp/WebApp.csproj --configuration Release --output "$(Build.ArtifactStagingDirectory)/app"
    displayName: Publish application

  - task: PublishPipelineArtifact@1
    inputs:
      targetPath: '$(Build.ArtifactStagingDirectory)/app'
      artifact: webapp

Replace the project path and SDK version with the supported version for your repository. Add your existing deployment job or release pipeline to deploy the published artifact. This build example does not provision an App Service, create credentials, or change a flag.

Apply the FeatBit settings to the running application environment through your normal secret and deployment configuration. A build job environment variable alone does not configure the deployed application's process. Use the official Use .NET task and pipeline artifact task documentation when adapting the pipeline.

4. Test the Existing Path and a Targeted Release

Before expanding exposure, record these checks:

Check Expected result in this demonstration
Known test user targeted to true /release-demo/<test-id> returns candidate
User outside the test audience The same route returns existing
Flag set to the existing variation Previously targeted users return to existing after the update reaches the SDK
A deliberately missing flag using fallback false The demo chooses existing
SDK starting without a usable initial connection The fallback path is observable and the initialization warning is visible
An initialized SDK temporarily losing connectivity Record its cached behavior separately from a cold start

Do not infer the last two results from a flag toggle while the network is healthy. Rehearse them separately in a test environment. The SDK overview explains client and server evaluation boundaries.

If you are replacing another provider, compare actual evaluations with the downloadable parity kit. A rollout with the same percentage can still assign different individual users after migration.

5. Expand Exposure With a Recovery Owner

Use a rollout plan such as internal users, a selected customer cohort, then a small percentage of the intended audience. Define the health signal, observation period, owner, and recovery action before each expansion. The percentages and wait periods should fit your traffic and risk; this guide does not claim a universal sequence.

Retain the existing implementation and its dependencies until the recovery window closes. If the change includes an incompatible database migration, turning a flag off does not reverse the schema or undo writes. Coordinate those changes with your data migration plan.

For implementation details, continue with progressive rollout patterns and feature flag lifecycle management. A temporary release flag should have an owner and removal condition before it becomes a permanent branch in the codebase.

What Should You Automate Later?

Once the manual release path works, you can connect approved release actions to the documented FeatBit management APIs. Keep management credentials separate from the SDK's environment secret, scope access to the intended environment, and verify the current API contract before writing a pipeline task.

A successful pipeline is evidence that the deployment completed. Production rollout needs its own application and user evidence. Keep those two decisions visible in the release record.

Evaluate This Workflow With Your Application

Deploy FeatBit locally, connect one service, and verify the table above before expanding the integration. For a private deployment or governance review, contact the FeatBit team with your runtimes, environment count, hosting boundary, and change-control requirements.

Updated November 16, 2026. The SDK usage follows FeatBit's official .NET documentation, and the pipeline follows Microsoft's task references. The demonstration is an implementation example, not a production availability or performance benchmark.