Skip to main content

Harness VS Code Extension

Last updated on

The Harness VS Code Extension brings Harness CI/CD pipeline monitoring, log viewing, deployment approvals, and AI-assisted debugging directly into Visual Studio Code. You can track pipeline executions, inspect logs, and approve deployments without leaving your IDE.

note

Looking for the Harness AI Code Agent (AI code completions and chat)? That feature has been updated. Go to Harness AI overview to find current AI-assisted development tools.


Before you begin

  • VS Code: Version 1.85.0 or later.
  • Harness account: An active Harness account with project access.
  • Personal Access Token (PAT): Generated in your Harness account. Go to Manage API keys to create one.

Install the extension

  1. Open the Extensions view in VS Code (Cmd+Shift+X on macOS or Ctrl+Shift+X on Windows/Linux).
  2. Search for Harness.
  3. Select the Harness extension published by Harness, Inc.
  4. Select Install.

Alternatively, install from the command line:

code --install-extension harness-inc.harness-vscode

Or go to the VS Code Marketplace and select Install.


Configure the extension

  1. Select the Harness icon in the VS Code Activity Bar.
  2. Run the command Harness: Configure API Key from the Command Palette (Cmd+Shift+P / Ctrl+Shift+P).
  3. Enter your Harness instance URL (default: https://app.harness.io).
  4. Enter your PAT. The extension automatically extracts your account ID from the token.
  5. Select your organization and project.

Use environment variables (CI/CD-friendly)

Set the following environment variables before launching VS Code to skip the credential prompts:

export HARNESS_API_KEY="your-pat"
export HARNESS_BASE_URL="https://app.harness.io"
export HARNESS_ACCOUNT_ID="your-account-id"

Set harness.authSource to env in your VS Code settings to activate environment variable authentication.


Monitor pipelines

The extension adds two views to the Harness Activity Bar panel:

  • Pipelines: Browse all accessible pipelines. Search, filter by status, and pin favorites.
  • Executions: View full execution history filtered by pipeline or status.

Both views refresh automatically on a configurable interval (default: 10 seconds). The extension pauses polling when the sidebar is hidden or VS Code loses focus to conserve resources.

View pipeline logs

Select any execution to open step-level logs in a dedicated editor tab with syntax highlighting. Failed steps are highlighted for quick triage.

Re-run a failed stage or test

Right-click a failed stage or test in the Executions view and select Re-run Failed Stage or Re-run Test via Harness to trigger a retry without leaving VS Code.

Export an execution

Select Export Current Execution to JSON from the Command Palette to export the latest execution details for offline debugging or sharing with your team.


Manage approvals

When a pipeline reaches an approval gate, the extension surfaces an inline prompt in the Executions view. Select Approve or Reject to respond without opening the Harness UI.

Supported approval types:

  • Harness native approvals
  • Jira approvals
  • ServiceNow approvals

Use AI-assisted debugging

The extension automatically injects pipeline context (pipeline name, execution status, step logs, branch and commit) into AI assistants when a failure is detected.

Supported AI platforms:

PlatformModeConfiguration
Claude CodeCLI: fully automated; Extension: semi-automatedActive Claude Code session required
GitHub CopilotAuto-detected via VS Code platformUses .vscode/mcp.json
CursorAuto-detected with auto-pasteGo to Harness AI Cursor Plugin to configure the Cursor integration

Configure MCP scope for Claude Code

The extension can write MCP configuration at two scopes:

ScopePathSharing
Project.mcp.json in workspace rootCommit to share with your team
Global~/.claude.jsonPersonal only, applies to all projects

Configuration reference

SettingTypeDefaultDescription
harness.baseUrlstringhttps://app.harness.ioHarness instance URL. Supports on-premises deployments.
harness.accountIdentifierstring""Account ID. Auto-extracted from PAT if left empty.
harness.authSourceenumpatAuthentication source: pat or env.
harness.orgIdentifierstringdefaultOrganization identifier.
harness.projectIdentifierstring""Project identifier.
harness.pollingIntervalSecondsnumber10Pipeline status refresh interval in seconds (5–120).
harness.defaultViewenumthisCommitDefault sidebar view: thisCommit or allExecutions.
harness.logLevelenuminfoLog verbosity: off, error, warn, info, or debug.

Switch projects per workspace

Run Harness: Switch Project (This Workspace) from the Command Palette to set a different org and project for the current workspace. This override is stored in workspace settings and does not affect other projects.


Troubleshooting


Next steps