• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    Azure DevOps

    Read time: 3 minutes
    Last edited: Dec 29, 2022
    The Azure DevOps integration is a Pro and Enterprise feature

    The Azure DevOps integration is available to customers on a Pro 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 our 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 flag types. To learn more, read Understanding flag types.

    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. Navigate to the Account settings page.
    2. Click into the Roles tab.
    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. Navigate to the Account settings page.
    2. Click into the Authorization tab.
    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.

    Configuring the Azure extension

    To configure the Azure extension:

    1. Navigate to your Azure DevOps project dashboard. Click Project Settings.
    2. Navigate to Pipelines > 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.

    Creating the rollout task

    The next step is to add our 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 Configuring the Azure extension.
    2. Set a percentage Rollout to apply to your feature flags.
    3. Choose the Flag state. This controls whether the flag 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 users in the LaunchDarkly environment you select.

    Configuring 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.

    Associating a feature flag with a release

    View the feature flags associated with an item from the "Work items" page.

    The LaunchDarkly work items page.
    The LaunchDarkly work items page.

    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.