Azure DevOps Integration

This guide explains how to integrate Wisec into your Azure DevOps pipelines using the two-stage setup: notarization + policy enforcement.

1. Prerequisites

  • A Wisec account and project.
  • Your Project ID from the dashboard.
  • Your Agent Signing Key (private key) generated from Settings → Signing Keys.

2. Configure Pipeline Variables

Pipelines > Library > Variable Groups (or pipeline-level variables) - add the following, marking sensitive values as secret:

VariableValueSecret
WISEC_PROJECT_IDYour numeric project IDNo
AGENT_PRIVATE_KEY_HEXYour Ed25519 private keyYes
WISEC_API_ENDPOINThttps://api.wisec.io/api/v1/eventsNo

3. Two-stage setup

The agent works in two independent stages with distinct roles. WisecNotify notarizes the build early alongside your build (and never blocks); WisecGate enforces your policies at the end after CVE analysis completes.

The WisecGate stage is required for policy enforcement. Policies (secrets, CVE, risk score…) are evaluated and recorded by WisecNotify, but they only ever block your pipeline through the gate. If you omit the gate stage, a build that violates a block policy will still pass. Keep the gate if you rely on policies; WisecNotify alone gives you notarization only.

yaml
trigger:
  - main
  - master

pool:
  vmImage: 'ubuntu-latest'

stages:
  - stage: Build
    displayName: 'Build & Notify'
    jobs:
      - job: Build
        steps:
          - script: echo "Your build command"
            displayName: 'Build'

      # Step 1 - Submit build record (non-blocking, runs early)
      - job: WisecNotify
        displayName: 'Wisec Notify'
        steps:
          - script: |
              curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
              curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
              mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
              chmod +x wisec-agent && ./wisec-agent && rm -f wisec-agent
            displayName: 'Run Wisec Agent'
            env:
              WISEC_PROJECT_ID: $(WISEC_PROJECT_ID)
              AGENT_PRIVATE_KEY_HEX: $(AGENT_PRIVATE_KEY_HEX)
              WISEC_API_ENDPOINT: $(WISEC_API_ENDPOINT)

  - stage: Test
    displayName: 'Tests'
    dependsOn: Build
    jobs:
      - job: Test
        steps:
          - script: echo "Your test command"

  # Step 2 - Policy gate (blocking, runs last)
  - stage: WisecGate
    displayName: 'Wisec Policy Gate'
    dependsOn: [Build, Test]
    jobs:
      - job: Gate
        steps:
          - script: |
              curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
              curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
              mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
              chmod +x wisec-agent && ./wisec-agent --gate && rm -f wisec-agent
            displayName: 'Wisec Gate'
            env:
              WISEC_PROJECT_ID: $(WISEC_PROJECT_ID)
              AGENT_PRIVATE_KEY_HEX: $(AGENT_PRIVATE_KEY_HEX)
              WISEC_API_ENDPOINT: $(WISEC_API_ENDPOINT)
              WISEC_GATE_TIMEOUT: "120"
              WISEC_STRICT: "false"

Gate environment variables

VariableDefaultDescription
WISEC_GATE_TIMEOUT120Max seconds to wait for analysis to complete
WISEC_STRICTfalseIf true, fails the gate when analysis times out. If false, passes silently - your CI is never broken by a Wisec outage

Policies evaluated in the gate

Post-analysis policies (cve_severity, risk_threshold) are evaluated once the CVE scan completes. Configure them in Dashboard → Policies.

4. Gitleaks (secret scanning)

yaml
      - job: WisecNotify
        steps:
          - script: |
              curl -fsSL https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz | tar xz
              chmod +x gitleaks && sudo mv gitleaks /usr/local/bin/
              curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
              curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
              mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
              chmod +x wisec-agent && ./wisec-agent && rm -f wisec-agent
            env:
              WISEC_PROJECT_ID: $(WISEC_PROJECT_ID)
              AGENT_PRIVATE_KEY_HEX: $(AGENT_PRIVATE_KEY_HEX)
              WISEC_API_ENDPOINT: $(WISEC_API_ENDPOINT)

5. SARIF report import

yaml
            env:
              WISEC_PROJECT_ID: $(WISEC_PROJECT_ID)
              AGENT_PRIVATE_KEY_HEX: $(AGENT_PRIVATE_KEY_HEX)
              WISEC_API_ENDPOINT: $(WISEC_API_ENDPOINT)
              WISEC_SCAN_REPORT_PATH: "$(Build.SourcesDirectory)/results.sarif"

Note: Secret pipeline variables are not automatically injected as environment variables in Azure DevOps. Always map them explicitly using the env: block in each step.

6. Binding the proof to the delivered artifact (optional)

By default, the provenance identifies the build by its source commit. To have it name the file you deliver, run the agent after the build and set WISEC_BINARY_PATH to that file. The installation guide explains what this changes, and its limits. Container images your build pushes can be named as well, with WISEC_IMAGE_DIGESTS (agent v1.3.0 or later): see Container images.

yaml
  - stage: Build
    jobs:
      - job: Build
        steps:
          - script: make build   # produces dist/myapp
            displayName: 'Build'

          - script: |
              curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
              curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
              mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
              chmod +x wisec-agent && ./wisec-agent && rm -f wisec-agent
            displayName: 'Wisec Notify'
            env:
              WISEC_PROJECT_ID: $(WISEC_PROJECT_ID)
              AGENT_PRIVATE_KEY_HEX: $(AGENT_PRIVATE_KEY_HEX)
              WISEC_API_ENDPOINT: $(WISEC_API_ENDPOINT)
              WISEC_BINARY_PATH: 'dist/myapp'

The agent becomes a step of the Build job, after compiling, so it sees the file in the same workspace. The separate WisecNotify job is no longer needed; the WisecGate stage is unchanged.

To check it worked, open the attestation from the dashboard: its subject reads artifact sha256:…. If it reads source commit …, the agent did not find the file.