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

Harness CLI Overview

A unified command-line interface for managing Harness pipelines, artifacts, infrastructure, and platform resources.

The Harness CLI provides a command-line interface for managing and automating resources across your Harness account. From a single terminal, you can trigger deployments, manage resources, rotate secrets, query audit logs, and perform many of the same actions available in the Harness UI.

Common use cases include:

  • Automating repetitive tasks: Create and manage pipelines, connectors, secrets, and other resources in bulk using YAML files or command-line flags.

  • Integrating with CI/CD workflows: Trigger pipeline executions, monitor execution status, and automate deployment workflows from scripts and external automation tools.

  • Troubleshooting and validation: View execution logs, inspect resource configurations, and verify connector connectivity without leaving the terminal.

  • Managing resources at scale: Export resources as JSON, compare configurations, and audit changes across accounts, organizations, and projects.


What you will learn in this topic

By the end of this page, you will understand:

  • How Harness CLI commands are structured, including actions, resources, identifiers, and flags.

  • Which actions are available and the operations they support.

  • How resource-specific commands extend base actions for specialized workflows.

  • Which Harness modules are supported and the resources available within each module.

  • How to discover and explore available commands directly from the terminal.


Command structure

Every Harness CLI command follows a consistent action resource identifier flags pattern:

For example:

This predictable command structure makes the CLI easier to learn and use. After you identify the action and resource you want to work with, you can discover available options through built-in help and tab completion.

Tab completion suggests resources, identifiers, flags, and valid values directly from the Harness API, helping you construct commands efficiently and accurately.


Core actions

The CLI provides six core actions that are available across most resources:

Action
Description

list

Display a collection of resources. You can optionally filter results by a parent resource, such as listing executions for a specific pipeline.

get

Retrieve details for a single resource by its identifier.

create

Create a new resource from a YAML file (--file or -f) or by specifying values with --set flags.

update

Modify an existing resource by updating fields with --set or removing fields with --del.

delete

Remove a resource by its identifier.

execute

Run or trigger an operation, such as executing a pipeline, starting a scan, or running an HQL query.

Some modules provide additional actions. For example, the Artifact Registry module includes push and pull commands for uploading and downloading package content.


Advanced resource operations

Some resources support specialized operations that extend the six core actions. These operations are represented using a resource:operation syntax.

Resource operations provide access to functionality that is specific to a particular resource. For example, pipeline:summary returns a lightweight overview of a pipeline without retrieving its complete YAML definition.

To discover available resource operations, run the following command:

This command displays all supported resources and resource operations available in your installed CLI version.


Modules

The Harness CLI organizes commands into modules. Each module groups related resources within a specific functional area:

Module
Resources it covers

Core

Authentication and profiles, install and upgrade, version, module and plugin discovery, and debug helpers

Platform

Account hierarchy, RBAC, connectors, secrets, settings, delegates, delegate tokens, Harness Worker Agents, and entity usage

Continuous Delivery

Pipelines, executions, triggers, input sets, templates and template versions, approvals, deployment freezes, services, environments, infrastructure definitions, and service overrides

Artifact Registry

Registries, artifacts, versions, metadata, push in 18 package formats, pull, install helpers, security scans, and migrations

Infrastructure as Code Management

Terraform and OpenTofu workspaces, remote plans, Ansible hosts, inventories, playbooks, and the module and provider registries

Code Repository

Repositories, pull requests, code review, reviewers and codeowners, AI review insights, branches, commits, tags, comments, and checks

GitOps

Agents, applications, destination clusters, source repositories, and ApplicationSets

Governance

OPA policies, policy sets, and policy evaluations

Audit

Read-only audit trail across every Harness resource

AI Evaluations

Datasets, metrics, metric sets, evaluation targets, models, evaluation runs, and suites

Knowledge Graph

Entity graph schema and HQL query engine (run, validate, explain)

All modules use the same command structure, flag conventions, and output formats. Once you learn how to work with one module, you can apply the same patterns across the rest of the CLI.


Discover commands interactively

You can explore available modules, resources, actions, and command options directly from the terminal:

If you enter an invalid resource name, the CLI suggests the closest matching resource and exits with a non-zero status code.


Next steps

Install the CLI, then log in and confirm which operations the CLI supports for the resources you plan to automate.

Last updated

Was this helpful?