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
- Go to the Level CI extension in the Visual Studio Marketplace .
- Click Get it free.
- Select your Azure DevOps organization from the list.
- Click Install.
2. Add a New Level CI Service Connection
NOTE: Manage security in Azure Pipelines
In your Azure DevOps project:
- Navigate to: Project Settings → Service connections
- Click New service connection.
- Select Level CI as the connection type.
- 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
- 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/cliThe 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.
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 Config5. 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:
- Ensure your e2e tests pass locally.
- 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.