> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-ai/use-harness-platform/connectors/monitoring-and-logging-systems/add-a-dynatrace-connector.md).

# Add a Dynatrace connector

Add a Dynatrace connector so Harness can fetch Classic metrics or Grail logs from Dynatrace for verification.

Dynatrace is a cloud-based observability platform that uses automatic discovery and AI-assisted analysis to monitor applications, infrastructure, and user experience, collecting metrics, traces, and logs. Add a Dynatrace connector in Harness to let your pipelines query metrics from your Dynatrace environment. Harness can then use that data in Continuous Verification to compare application behavior before and after a deployment, helping you confirm a release is healthy or trigger a rollback.

Harness supports two Dynatrace integrations, and each connector uses one of them:

* **Dynatrace Classic**: Full Stack Observability metrics, using an API URL and API token.
* **Dynatrace Grail**: Dynatrace Grail Logs, using a platform URL and platform token.

Go to [Overview](https://developer.harness.io/harness-ai/use-harness-platform/connectors/monitoring-and-logging-systems/monitoring-and-logging-systems-connectors-overview.md) for information about all monitoring and logging connectors, such as scopes and delegate selection.

***

## What you will learn from this topic

* How to [add a Dynatrace connector](#add-a-dynatrace-connector) to a Harness project.
* How to configure the [credentials](#credentials) for Dynatrace Classic or Dynatrace Grail.

***

## Before you begin

* **Dynatrace access**: A Dynatrace environment where you can generate an API token, or a platform token for Grail.
* **Harness permissions**: Permission to create connectors and secrets in Harness.

{% hint style="info" %}
**Dynatrace Grail Logs feature flag**

Dynatrace Grail Logs support is behind the feature flag `CDS_CV_DYNATRACE_GRAIL_LOGS_ENABLED`. This feature requires a minimum delegate version of `869xx`. Contact [Harness Support](mailto:support@harness.io) to enable the feature flag.

Without the feature flag, you see only the default Dynatrace configuration, which is API URL and API Token for Dynatrace Classic. With the feature flag, you can select between Dynatrace Classic and Dynatrace Grail.
{% endhint %}

***

## Add a Dynatrace connector

You can add a Dynatrace connector at the project, org, or account scope. This procedure covers the project scope, and the process is the same for org and account scope.

Perform the following steps to add a Dynatrace connector:

1. Open your Harness project.
2. In **Project Settings**, select **Connectors**.
3. Click **New Connector**, then select **Dynatrace** under **Monitoring and Logging Systems**. The Dynatrace connector settings appear.

### Overview

Configure the identity fields for the connector:

1. In **Name**, enter a name for the connector. Harness generates the **Id** from the name.
2. Optionally, add a **Description** and **Tags**.
3. Click **Continue**.

![Dynatrace connector overview settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-7ab4ef63bdf9ed2efe535a453493109398f064eb%2Fdynatrace-connector-overview.png?alt=media)

### Credentials

Select a **Dynatrace Verification Provider** from **Dynatrace Classic** and **Dynatrace Grail**.

Configure the following settings based on the verification provider you selected:

1. If you selected **Dynatrace Classic**:

   * In **URL**, enter the URL of your Dynatrace account. You must use an HTTPS URL.
   * In **API Token**, select or create a new [Harness encrypted text secret](https://developer.harness.io/harness-ai/use-harness-platform/secrets/add-use-text-secrets.md) that stores your **Dynatrace API token**.

   Go to [Access tokens (Dynatrace Classic)](https://docs.dynatrace.com/docs/manage/identity-access-management-classic/access-tokens-and-oauth-clients/access-tokens) in the Dynatrace documentation to create an access token.

   ![Dynatrace connector credentials with the Dynatrace Classic settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-853716cc54c0fb7ddd7b94fec8e214ae1bb32d02%2Fdynatrace-connector-credentials-classic.png?alt=media)
2. If you selected **Dynatrace Grail**:

   * In **Platform URL**, enter the platform URL of your Dynatrace account. You must use an HTTPS URL.
   * In **Platform Token**, select or create a new [Harness encrypted text secret](https://developer.harness.io/harness-ai/use-harness-platform/secrets/add-use-text-secrets.md) that stores your **Dynatrace platform token**. The token needs the following permissions:

     For connector setup:

     ```
     ALLOW automation:workflows:read
     ```

     For verifying and running log-based queries:

     ```
     ALLOW storage:buckets:read WHERE storage:table-name = "logs"
     ALLOW storage:logs:read
     ALLOW automation:workflows:read
     ```

   Go to [Platform tokens](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/platform-tokens) in the Dynatrace documentation to create a platform token.

   ![Dynatrace connector credentials with the Dynatrace Grail settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-50459e970f1ee7bbd0dfd8d9231c3c30f1564054%2Fdynatrace-connector-credentials-grail.png?alt=media)

{% hint style="warning" %}
**One configuration per connector**

Each Dynatrace connector instance supports either Classic (API URL and API token) or Grail (platform URL and platform token), but not both. Create two connectors if you want to use both.
{% endhint %}

### Delegates Setup

Select one of the following options:

* **Use any available Delegate**: Harness selects an available delegate at runtime.
* **Only use Delegates with all of the following tags**: Enter the tags of the delegates Harness must use with this connector.

The **Test Delegate Connectivity** list shows the delegates that match your selection. To add a delegate, click **Install new Delegate**.

Click **Save and Continue**.

![Dynatrace connector delegates setup with the delegate connectivity list](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-2ebc574fcb82e8d539e1d6e7e9ae12c166cfbe21%2Fdynatrace-connector-delegates-setup.png?alt=media)

### Verify Connection

Click **Finish** after the connection test succeeds. The connector is listed in **Connectors** page.

***

## Sample YAML

The following example shows a YAML for a Dynatrace Classic connector.

<details>

<summary>YAML - Dynatrace connector</summary>

```yaml
connector:
  name: your-dynatrace-connector # Replace with a name for your connector
  identifier: yourdynatraceconnector # Replace with a unique identifier
  accountIdentifier: youraccountidentifier # Replace with your Harness account identifier
  orgIdentifier: default # Replace with your organization identifier, or remove for account scope
  projectIdentifier: yourprojectidentifier # Replace with your project identifier, or remove for org/account scope
  type: Dynatrace
  spec:
    url: https://abc12345.live.dynatrace.com/ # Replace with the URL of your Dynatrace environment
    apiTokenRef: your-api-token-secret # Replace with a reference to the Harness secret storing your Dynatrace API token
    ignoreTestConnection: false # Set to true only to skip connector preflight checks
```

</details>

For the full connector YAML schema, including how to skip connector preflight checks, go to [Create a connector using YAML](https://developer.harness.io/harness-ai/use-harness-platform/connectors/create-a-connector-using-yaml.md).

***

## Next steps

* [Use delegate selectors](https://developer.harness.io/harness-ai/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md): Control which delegates can connect to this connector.
* [Add a text secret](https://developer.harness.io/harness-ai/use-harness-platform/secrets/add-use-text-secrets.md): Store the Dynatrace token as a Harness secret.
