For the complete documentation index, see llms.txt. This page is also available as Markdown.

Azure DevOps

This article shows you how to integrate Qwiet AI by Harness into your Azure DevOps workflow to provide automated code analysis. We provide two sets of instructions based on how you define your Azure pipelines: using YAML syntax or the Classic interface.

For Azure Pipelines defined using YAML syntax

This tutorial assumes that you have an existing YAML-base Azure Pipeline defined. You will be adding the tasks required to integrate Qwiet AI by Harness to this file.

Step 1: Create your secret variables

You will need to create secret variables to store authentication information for Qwiet.

We recommend creating your secret variables using variable groups since this method balances security with ease of deployment across multiple repositories.

Add variable group

However, you could also create your secret variables using:

When creating a variable group, we recommend calling it something like shiftleft-token. You can then provide your access token as SHIFTLEFT_ACCESS_TOKEN.

When running in a production environment, we recommend that you use a CI config token as the access token. You can create your CI config token in the Qwiet Dashboard.

Add Qwiet tokens

At this point, you can refer directly to this group in the pipeline's YAML configuration file using the group property under the variables section.

Step 2: Add Qwiet to your pipeline

You will need to include instructions in your Pipeline to download the Qwiet CLI so that the Pipeline can run Qwiet AI by Harness.

If you're running Windows, you can do so using a PowerShell task:

If you're running Linux or macOS, you can use a script task:

Step 3: Invoke Qwiet AI by Harness for code analysis

The following sections will show you how to analyze your Java or C# applications.

When invoking Qwiet AI by Harness, you need to refer to the SHIFTLEFT_ACCESS_TOKEN variable. As suggested earlier in this article, if you create a variable group, these variables will be available automatically to all of your Pipelines.

Analyzing a Java application

The following examples show how you can build your Java application (which is required before Qwiet AI by Harness can analyze your code), then use the Qwiet CLI to invoke Qwiet AI by Harness for code analysis.

Please note that the Qwiet CLI requires Java 8 to create the Code Property Graph (CPG) representation of your source code. This is necessary before code analysis unless you are analyzing a project written in C#. If so, you can skip this step.

To set up Java 8, use the Java Tool Installer.

On Windows:

On Linux/macOS:

Analyzing a C# application

The following examples show you how to build your .NET Core application, then use the Qwiet CLI to invoke Qwiet AI by Harness for code analysis.

For .NET applications, pass in the .sln file instead of the .csproj file:

To pass additional information to Azure, you can use predefined variables that you then reference in the env block of your script.

Recursively finding and scanning your solution/project files

The following example shows you how to modify the sl analyze invocation to recursively find all .sln files and scan them with Qwiet:

Alternatively, you can recursively find and scan all .csproj files if .sln-based scans are taking too long:

For Azure Pipelines defined using the classic interface

If you haven't already, sign in to your Azure DevOps organization. Then, open up the project where you would like to configure your pipeline and navigate to the details page for your pipeline.

You need to create a series of tasks to execute each part of the code analysis workflow.

Step 1: Download Qwiet AI by Harness

First, create a task to download Qwiet. This will be an inline task, and under Script, provide:

Download Qwiet

Step 2: Run Qwiet AI by Harness

Next, create another inline task to run Qwiet and analyze your code. The required script is:

Set code analysis to run

Step 3: Display findings

Finally, create your third inline task to display your results:

Be sure to update the SHIFTLEFT_ACCESS_TOKEN placeholder with your Qwiet access token, which is available in the Qwiet Dashboard under Access Token.

Display the results of your findings

Recursively finding and scanning your solution/project files

The following example shows you how to modify the sl analyze invocation to recursively find all .sln files and scan them with Qwiet:

Alternatively, you can recursively find and scan all .csproj files if .sln-based scans are taking too long:

Running sl check-analysis in Azure DevOps

Qwiet's check-analysis feature allows you to compare your analysis results against a set of build rules you've defined. To use check-analysis in your Azure DevOps workflow, you must first enable build validation on your branch.

Last updated

Was this helpful?