Try it free

Getting started

  • Latest Dynatrace
  • How-to guide
  • 5-min read

This guide walks you through installing Dynatrace Extensions Dynatrace Extensions in Visual Studio Code, connecting to your Dynatrace environment, and publishing your first extension using the built-in VS Code workflows.

Before you begin

Installation

You can find Dynatrace Extensions Dynatrace Extensions in the Visual Studio Code marketplace. Install it from there or via the VS Code extension search.

Platform token

Our VS Code add-on automates many operations around extensions development by using the Dynatrace API.

To get the most out of it, create a Platform token with the following scopes:

  • extensions:definitions:read
  • extensions:definitions:write
  • extensions:configurations:read
  • extensions:configurations:write
  • extensions:discovery.jmx:read
  • extensions:discovery.pmi:read
  • storage:buckets:read
  • storage:metrics:read
  • storage:entities:read
  • storage:smartscape:read
  • settings:objects:read
  • credential-vault:entries:read
  • credential-vault:entries:write
  • credential-vault:entries:admin

Connect to Dynatrace

To connect your Dynatrace environment

  1. Go to Dynatrace Extensions in the Extensions view in Visual Studio Code, then select Add environment.

  2. Provide the base URL to access Dynatrace. It should follow this pattern:

    https://<Id>.apps.dynatrace.com

    Replace <Id> with your tenant ID.

  3. Provide the token you prepared earlier and optionally provide a label.

  4. Set this as your current environment.

VS Code now displays your environment in the list and uses it for all API operations. To learn more about using the Environments view, see Environments.

Initialize your workspace

It's time to create your first project. If you have to open a different workspace folder, select Open folder. Otherwise, select the Initialize workspace button to start.

To learn how to use the Workspaces view, visit Extension workspaces.

1. Schema validation

The workflow starts with your target schema version. Choose any from the list. It ensures that we can validate your extension manifest while you're writing it, allowing you to spot any issues early on.

2. Developer certificates

Developer certificates are used to sign and package your extension. Choose Generate new ones to generate a new set of certificates kept in VS Code's storage.

Check the extension's settings to get the exact path to where your credentials are stored.

The workflow offers some additional convenience steps:

  • Whether to use these certificates as defaults for all workspaces:

    • This will update your global settings for Dynatrace Extensions to reflect this choice.
    • As part of this guide, choose Yes.
  • Whether to upload the new CA certificate to the Dynatrace Credentials Vault.

    • You need to provide a name and, optionally, a description.
    • As part of this guide, choose Yes and provide the additional details.
  • Whether to upload the new CA certificate to locally installed OneAgents and ActiveGates.

    • This step only appears if a local OneAgent or ActiveGate installation is detected.
    • This step requires running VS Code with Administrator privileges.
    • As part of this guide, choose No.

To learn how to use your existing developer certificates, visit Credentials.

3. Project template

The final step of the workflow is to choose the type of project you want to start. It allows the extension to generate relevant files.

Since this is your first extension, choose Extension 2.0 ⭐ at this step.

This option is the default choice for new projects and creates the following starting setup:

  • extension - the folder where all extension assets are placed.
  • extension/extension.yaml - this is your extension's manifest file.

To learn more about the other types of projects, visit Project templates.

In addition, all templates also create the following folders and files:

  • .vscode - a folder for storing workspace-specific VS Code settings.
  • dist - a folder for storing all extension packages.
  • config - a folder for storing your monitoring configuration files.
  • .gitignore - a file containing useful rules for ignoring unnecessary items from your git repository.

Make some changes to your extension

Start by opening up the extension manifest and making some changes. Give your extension a name, and add yourself as the author.

For example, update the extension/extension.yaml file with the following information:

name: custom:my.first.extension
version: "0.0.1"
minDynatraceVersion: "1.265.0"
author:
name: <Your-Name>

Replace <Your-Name> with the author's name.

Publish your extension

Finally, perform the following steps to upload your extension to Dynatrace.

  1. Select the F1 key and choose the Dynatrace extensions: Build command. The workflow builds your extension and creates a package inside your dist folder.
  2. When prompted about uploading your extension to Dynatrace, choose Yes.
  3. When prompted about activating this extension version, choose Yes.

Congratulations. You created, built, uploaded, and activated your first Extension. You can view it in Dynatrace in Extensions Extensions.

Related tags
ExtensionsExtensionsInfrastructure Observability