Skip to Content
Get startedStep 3: build environmentBuild environment with Azure DevOps

Build environment with Azure DevOps

Level CI integrates into your Azure Pipelines through a custom Visual Studio Marketplace extension. The main purpose of the extension is to collect accessibility reports generated during e2e tests execution and to trigger analysis via Level CI API.

To build your environment:

1. Install Level CI Extension

  1. Go to the Level CI extension in the Visual Studio Marketplace.
  2. Click Get it free.
  3. Select your Azure DevOps organization from the list.
  4. Click Install.

2. Add a New Level CI Service Connection

NOTE: Manage security in Azure Pipelines

In your Azure DevOps project:

  1. Navigate to: Project Settings → Service connections
  2. Click New service connection.
  3. Select Level CI as the connection type.
  4. Fill in the required fields:
    • Project Token: (paste the token from Level CI)
    • Project Name: level-ci-azure-integration
    • Organization Slug: org_slug
    • Service Connection Name: Level CI
  5. Click Verify → you should see Verification Succeeded.

3. Install the Level CI CLI

Install the @level-ci/cli package in the root of your project:

npm install --save-dev @level-ci/cli

The CLI provides a command-line tool and TypeScript types for configuration files.


4. Create the Configuration File

In the root of your project, create a level-ci.config.ts (or .js) file. Make sure the LEVEL_CI_TOKEN environment variable is set using the project token generated in Level CI.

level-ci.config.ts
import type { Config } from '@level-ci/cli' export default { organization: 'your_organisation', project: 'your_project', token: process.env.LEVEL_CI_TOKEN, reportPaths: ['./level-ci-reports'], } satisfies Config

5. Update azure-pipelines.yml

Add a new Level CI task after your end-to-end (e2e) test execution step. Make sure the credentials value matches the Service Connection name you created earlier (Level CI).

- task: LevelCIAnalyze@0 inputs: credentials: 'Level CI'

⚠️ Note: To enable access to the credentials for the first time, your Azure DevOps project administrator must grant permission to use the service connection in pipelines.


6. Verify configuration

Before committing your changes, validate the setup locally:

  1. Ensure your e2e tests pass locally.
  2. Run the following command in your terminal:
npx level-ci --verify --token=<your_project_token>

7. Troubleshooting

If you encounter issues, refer to the troubleshooting guide.

Last updated on