No results for ""
EXPAND ALL
  • Home
  • API docs

Azure DevOps

Read time: 5 minutes
Last edited: Oct 02, 2024
The Azure DevOps integration is a Foundation and Enterprise feature

The Azure DevOps integration is available to customers on a Foundation or Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

Overview

This topic explains how to use Azure DevOps integration to control feature flags.

The Azure DevOps integration lets you perform controlled rollouts to manage feature releases. With this integration, you can define a percentage rollout for your feature flags as part of a release task.

The Azure DevOps integration supports boolean flags only

Currently, this integration only supports boolean flags. To learn more, read Flag templates.

Prerequisites

To complete this procedure, you must have the following prerequisites:

  • The Azure extension from the Azure DevOps Marketplace. Before you add the extension to any of your Azure DevOps projects, you must first add it to your Azure DevOps organization.
    • If your organization has not installed the extension, click Get it free on the Marketplace listing. Then, add the LaunchDarkly extension to your Azure DevOps project so the extension can connect to your LaunchDarkly account.
  • A personal or service API access token. To learn more, read API access tokens.

Set up the Azure extension

To set up the VSCode extension, you must complete the following steps:

  1. Give your API access token the required permissions:
  1. Configure the Azure extension with the API access token.

Give your API access token the required permissions

You can create a custom role with appropriate permissions then add the custom role to a personal or service access token, or you can add the built-in Writer role to your personal access token.

Create a custom role and add it to an API access token

Expand Create a custom role and add it to an API access token
Service tokens and custom roles are Enterprise features

Service tokens and custom roles are available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

To create a custom role for the API access token:

  1. Click the gear icon to view Organization settings.
  2. Click Roles.
  3. Click Create role. The "Create custom role" panel appears.
  4. Give the custom role a human-readable name.
  5. Grant write access to the environments and feature flags relevant to your Azure DevOps projects.
  6. Click Save role.

Add the built-in Writer role to your personal access token

Expand Add the built-in Writer role to your personal access token

To add the built-in Writer role to a personal access token:

  1. Click the gear icon to view Organization settings.
  2. Click Authorization.
  3. Find the personal access token you want to add permissions to and select "Edit token" from its overflow menu. The "Edit" panel appears.
  4. In the Role menu, select "Writer."
  5. Click Save token.

Your personal token now has the Writer role.

Configure the Azure extension

To configure the Azure extension:

  1. Navigate to your Azure DevOps project dashboard. Click Project Settings.
  2. Navigate to Pipelines, then Service Connections.
  3. Click Create service connection and select LaunchDarkly.
  4. Enter your LaunchDarkly API Access token.
  5. Enter a Service connection name.
  6. (Optional) Enter a Description.
  7. Click Save.
The Azure DevOps "New LaunchDarkly service connection" screen.
The Azure DevOps "New LaunchDarkly service connection" screen.


Create the rollout task

The next step is to add the rollout task to your release definitions.

Rollouts only work with the default collection

You cannot associate rollouts with collections that are not the default. If you do, the rollout won't be able to find the collection.

To find the rollout task:

  1. Navigate to the Add tasks dialog in Azure DevOps.
  2. Click into the Deploy tab.
  3. Choose LaunchDarkly Rollout.
The LaunchDarkly Rollout task in Azure DevOps.
The LaunchDarkly Rollout task in Azure DevOps.
  1. Choose the Account to update. This menu contains the service endpoints you configured in Configure the Azure extension.
  2. Set a percentage Rollout to apply to your feature flags.
  3. Choose the Flag state. This controls whether the targeting is on or off on release.
The task rollout settings.
The task rollout settings.

In this example, any feature flags associated with the release are set to be rolled out to 10% of your chosen contexts in the LaunchDarkly environment you select.

Associate a feature flag with a release

To associate a feature flag with a release:

  1. Navigate to the "Work items" page in Azure DevOps.
  2. Select the "LaunchDarkly" tab to view the feature flags associated with an item on the "Work items" page:
The Azure DevOps "Work items" page, with the "LaunchDarkly" tab called out.
The Azure DevOps "Work items" page, with the "LaunchDarkly" tab called out.
  1. On the "LaunchDarkly" tab, select the feature flag to associate with a release:
The list of feature flags on the "LaunchDarkly" tab.
The list of feature flags on the "LaunchDarkly" tab.

When you release to an environment, the rollout task updates any flag you linked with a work item.

This also updates the LaunchDarkly section on your release page. It shows all the feature flags affected by this release:

The LaunchDarkly section of the release page.
The LaunchDarkly section of the release page.
Work items must be linked to your release

For the rollout task to succeed, you must link the relevant work items to the release. To learn how, read the Azure Devops documentation on how to Link work items to objects.

Configure authentication

To ensure the task can access your work items, you must allow Azure DevOps to authenticate with LaunchDarkly. This process differs based on which version of the integration you are using. If you don't know which version of the integration you are using, you are probably using the v3 version.

v3 of the Azure DevOps integration

To configure authentication, define some custom variables to pass between Azure DevOps and LaunchDarkly:

  1. Navigate to the Configuration tab of the release page in Azure DevOps.
  2. Enter the launchdarkly-account-name. This is account name of the Azure DevOps account.
  3. Enter the launchdarkly-project-name. This is the project name of the Azure DevOps project.
  4. Enter the launchdarkly-pat. This is for the Azure DevOps personal access token that the integration will use to reach out to the Azure DevOps API.
The v3 variable configuration.
The v3 variable configuration.

Pre-v3 versions of the Azure DevOps integration

To configure authentication, define some custom variables to pass between Azure DevOps and LaunchDarkly:

  1. Navigate to the Configuration tab of the release page in Azure DevOps.
  2. Enter the accountName.
  3. Enter the alternatePassword.
  4. Enter the alternateUsername.
  5. Enter the projectName.