Create a connector using YAML
Harness Connectors integrate Harness with your cloud platforms, codebase and artifact repos, and collaboration and monitoring tools.
You can add Connectors using the Harness GUI or via YAML using the Harness YAML Builder.
This topic shows you how to add a Connector using the YAML Builder.
Step 1: Create Secrets or Keys
Typically, Connectors use passwords or SSH keys to authenticate with platforms, tools, etc.
In Harness, you create a Harness secret for the password or SSH key, and then reference that secret's ID when you create your Connector.
You can create a secret at the Project, Org, or account level. In this example, we'll use Projects.
In Resources for a Project, Org, or account, click Secrets.
Click Create via YAML Builder.
Use a snippet to create the secret.
Here's an example of a Harness inline text secret in YAML:
secret:
type: SecretText
name: docs-dockerhub-password
identifier: docsdockerhubpassword
orgIdentifier: Doc
tags: {}
spec:
secretManagerIdentifier: harnessSecretManager
valueType: Inline
The identifier value (in this example, docsdockerhubpassword) is what you'll reference when you add your Connector in YAML.
For steps on other types of secrets, see Secrets and Secret Management.
Step 2: Create the Connector
In Resources, click Connectors.
Click Create via YAML Builder.
Copy and paste the snippet for the Connector you want to create.
For example, here is the snippet for a Docker Hub Connector:
connector:
name: SampleDockerConnector
identifier: SampleDockerConnectorId
description: Sample Docker Connector
orgIdentifier: Doc
projectIdentifier: Example
type: DockerRegistry
spec:
dockerRegistryUrl: somedockerregistryurl
providerType: DockerHub
auth:
type: UsernamePassword
spec:
username: someuser
passwordRef: somepasswordref
Replace the values for the name and identifier keys.
Replace any URL values.
Provide values for the credentials keys.
For any password/key labels, paste the secret/key's identifier value.
For example, using the identifier from the secret created earlier (docsdockerhubpassword), the Docker Hub Connector would now be:
connector:
name: ExampleDockerConnector
identifier: ExampleDockerConnectorId
description: Example Docker Connector
orgIdentifier: Doc
projectIdentifier: Example
type: DockerRegistry
spec:
dockerRegistryUrl: https://registry.hub.docker.com/v2/
providerType: DockerHub
auth:
type: UsernamePassword
spec:
username: john.doe@example.com
passwordRef: docsdockerhubpassword
Click Save. The Connector is added and can be select in Pipeline stages.
Optional: Skip connector preflight checks
By default, Harness performs a connection test (preflight check) when you create or update a connector to validate that the credentials are correct and the remote service is accessible. However, in some environments with network restrictions, split DNS, proxy configurations, or restrictive firewall policies, these connection tests may fail even though the connector will work properly at runtime.
If you need to skip connector preflight checks, you can add the ignoreTestConnection: true property to your connector's YAML configuration. This requires the CI_IGNORE_TEST_CONNECTION feature flag to be enabled for your account. Contact Harness Support to enable this feature flag.
When both the feature flag and the ignoreTestConnection property are enabled, connection tests will always return as "Successful" without performing actual connectivity validation.
Example with ignoreTestConnection enabled:
connector:
name: ExampleDockerConnector
identifier: ExampleDockerConnectorId
description: Example Docker Connector
orgIdentifier: Doc
projectIdentifier: Example
type: DockerRegistry
spec:
dockerRegistryUrl: https://registry.hub.docker.com/v2/
providerType: DockerHub
auth:
type: UsernamePassword
spec:
username: john.doe@example.com
passwordRef: docsdockerhubpassword
ignoreTestConnection: true
Use this feature carefully. Skipping connection tests means Harness won't validate whether the connector credentials are correct or if the remote service is accessible. Only use this when you're certain the connector will work at runtime despite failing preflight checks.