Integrate OneAgent on Azure Virtual Machines

Dynatrace provides a VM Extension to install OneAgent on Azure Virtual Machines. This enables you to leverage the native deployment automation features using Azure Resource Manager (ARM). The Dynatrace VM extension is available for Windows and Linux in all public Azure regions (including support for Classic Virtual Machines).

The extension doesn't include the OneAgent installer. Instead, the extension uses the Dynatrace REST API to download the latest installer from the cluster, unless a OneAgent default version is configured.

Prerequisites

The server URL is required only if you use either of the following:

  • a Dynatrace Managed endpoint
  • an ActiveGate for a Dynatrace Managed or Dynatrace SaaS endpoint

If you use Dynatrace SaaS, the URL is automatically generated from the environment ID.

The server URL for Dynatrace Managed:
https://{your-domain}/e/{your-environment-id}/api The server URL for ActiveGate:
https://<your-active-gate-IP-or-hostname>:9999/e/<your-environment-id>/api (the ActiveGate port is configurable)
Note: If you're using Dynatrace Managed or your cluster traffic should be routed through an ActiveGate, you need to configure the API endpoint used by the extension for downloading OneAgent.

Install Dynatrace OneAgent VM extension

There are several ways to install the Dynatrace OneAgent VM extension: through Azure Portal, Azure CLI, or PowerShell, or by using an ARM template. Follow the steps below for instructions.

Add the extension to an existing VM

  1. In Azure Portal, go to an existing virtual machine where you want to add the OneAgent extension.
  2. In the left menu, go to Settings and select Extensions.
  3. Select Add.
  4. Select Choose extension.
  5. From the list of extensions, select Dynatrace OneAgent.
  6. Select Create to add the extension.
  7. On the Install extension page, enter your environment ID, your API token, and your server URL. See Prerequisites for details.
  8. Select whether you want to enable Log Monitoring.
  9. optional Define the host group to which the VM belongs.
  10. Select OK.
  11. To check the deployment status, in your Dynatrace environment, go to Manage and select Deployment status.

After installation is complete, restart your applications on the VM. Immediately after restart, OneAgent will begin monitoring them.

Add the extension to a new VM

  1. During the creation of a new VM in the deployment wizard, in Advanced, select Select an extension.
  2. Select Dynatrace OneAgent.
  3. Select Create.
  4. On the Install extension page, enter your environment ID, your API token, and your server URL. See Prerequisites for details.
  5. Select whether you want to enable Log Monitoring.
  6. optional Define the host group to which the VM belongs.
  7. Select OK.
  8. Continue VM configuration in the deployment wizard.
  9. Select Review and create.
  10. To check the deployment status, in your Dynatrace environment, go to Manage and select Deployment status.

After installation is complete, restart your applications on the VM. Immediately after restart, OneAgent will begin monitoring them.

Install Dynatrace OneAgent VM extension via an ARM template

Alternatively to the main installation methods, you can make the Dynatrace VM extension part of your ARM templates.
The JSON file for a virtual machine extension can be nested inside the virtual machine resource, or placed at the root or top level of a resource manager JSON template. The placement of the JSON file affects the value of the resource name and type.

  • The following example assumes the OneAgent extension is nested inside the virtual machine resource. When nesting the extension resource, the JSON file is placed in the "resources": [] object of the virtual machine.
{
    "type": "extensions",
    "name": "dynatrace",
    "apiVersion": "2018-06-01",
    "location": "[resourceGroup().location]",
    "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/', <VM-Name>)]"
    ],
    "properties": {
        "publisher": "dynatrace.ruxit",
        "type": "<Extension-Type>",
        "typeHandlerVersion": "<Extension-Version>",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "tenantId": "<Environment-ID>",
            "token": "<API-Token>",
            "server": "<Server-Url>",
            "enableLogAnalytics": "yes",
            "hostGroup": "<Host-Group>"

        },
    }
}
  • When placing the extension JSON at the root of the template, the resource name includes a reference to the parent virtual machine, and the type reflects the nested configuration.
{
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "name": "<Parent-VM-Resource>/dynatrace",
    "apiVersion": "2018-06-01",
    "location": "[resourceGroup().location]",
    "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/', <VM-Name>)]"
    ],
    "properties": {
        "publisher": "dynatrace.ruxit",
        "type": "<Extension-Type>",
        "typeHandlerVersion": "<Extension-Version>",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "tenantId": "<Environment-ID>",
            "token": "<API-Token>",
            "server": "<Server-Url>",
            "enableLogAnalytics": "yes",
            "hostGroup": "<Host-Group>"
        }

    }
}
Parameter Required Description
Parent-VM-Resource required Name of the parent VM resource where you want to install the extension. Not applicable when using nested resource.
VM-Name required Name of the VM where you want to install the extension.
Extension-Type required For Windows-based VMs, use oneAgentWindows. For Linux-based VMs, use oneAgentLinux.
Extension-Version required Required version of the extension.
tenantId required The environment ID as described in Prerequisites.
token required The PaaS token as described in Prerequisites.
server optional The server URL, if you want to configure an alternative communication endpoint as described in Prerequisites.
enableLogsAnalytics optional Set to yes if you want to enable Log Monitoring.
hostGroup optional Define the host group to which the VM belongs.

To check the deployment status, in your Dynatrace environment, go to Manage and select Deployment status.

After installation is complete, restart your applications on the VM. Immediately after restart, OneAgent will begin monitoring them.

Configure network zones optional

To configure network zones, use the installer arguments below.

az vm extension set 
  --publisher dynatrace.ruxit 
  -n "oneAgentLinux" 
  -g "yourresourcegroup" 
  --vm-name "awesome-vm" 
  --settings "{\"tenantId\":\"myawesometenant\",\"token\":\"nope123\", \"installerArguments\":\"--set-host-group=example_hostgroup --set-infra-only=false --set-network-zone=<your.network.zone>\"}"

See network zones for more information.