How do I deploy OneAgent to Azure Compute VMs?

The Azure VM Extension Gallery makes it easy to extend the functionality of your virtual machines. Here you'll find all the information you need to set up the Dynatrace OneAgent Azure VM extension, which is currently in a beta release phase.

Please note that these instructions only apply to monitoring Azure Virtual Machines.

If you intend to monitor Azure App Services, see How do I monitor Microsoft Azure Web Apps? for instructions.

For monitoring Azure Service Fabric clusters, please visit How do I monitor Azure Service Fabric applications? for instructions.

To deploy OneAgent to Azure Compute VMs, follow the steps described below.

Generate your Azure PaaS token

The first step is to get the Dynatrace environment ID for your monitored environment and generate a PaaS token for Azure. This information is used to map your Azure account to your Dynatrace account.

  1. Login with your Dynatrace account.

  2. Select Deploy Dynatrace from the navigation menu.

  3. Click the Set up PaaS integration button.

  4. Your environment ID appears in the Environment ID text box. You'll need this ID to link your Dynatrace account with your PaaS environment. Click Copy to copy the ID to the clipboard. You can do this at any time by revisiting this page.

  5. To generate a PaaS token, click the Generate new token button. The PaaS token is essentially an API token that's used in combination with your environment ID to download Dynatrace OneAgent. As you will notice, there is already a default InstallerDownload token available that you could alternatively use. However, for security reasons, it is recommended that you create several discrete tokens for different environments.

  6. Type in a meaningful name for your PaaS token. A meaningful token name might be the name of the PaaS platform you want to monitor (for example, azure, cloud-foundry, or openshift). To view and manage your existing PaaS tokens, go to Settings -> Integration -> Platform as a Service.

  7. Click Generate to create the PaaS token. The newly created PaaS token will appear in the list below. Click Copy to copy the generated token to the clipboard. You can do this at any time by revisiting this page and clicking Show token next to the relevant PaaS token.

Install Dynatrace OneAgent Azure VM extension via Azure Portal

  1. Navigate to an existing Compute instance, or create a new instance.

  2. Select Extensions and click Add.

  3. Select Dynatrace OneAgent from the list of extensions.

  4. Paste or type in your Dynatrace Environment ID.

  5. Paste or type the PaaS token you generated into the API Token text field.

  6. Click OK. After a couple of minutes, your Azure host will show up in Dynatrace, as shown below.

Install Dynatrace OneAgent VM extension via Azure CLI 2.0

Replace all values marked with <...> with your actual values.

  1. Login to your Azure account. If you're using Azure Cloud Shell, you can skip this step.
az login
  1. Add the VM extension to the VM scale sets.

For Windows-based Service Fabric clusters, execute the following command. Please note that the settings are submitted in JSON format, which requires proper escaping, as the command is submitted as a string.

az vm extension set
  -n oneAgentWindows
  --publisher dynatrace.ruxit
  -g "<resource group name>"
  --vm-name "<VMSS name>"
  --settings "{\"tenantId\":\"<your environment ID>\",\"token\":\"<PaaS token>\"}"

If you're using Dynatrace Managed, be sure to add the server's address to the settings JSON. The value is the address only, without https:// and without any subpaths.

--settings "{\"server\":\"<Dynatrace Managed URL>\",\"tenantId\":\"<your environment ID>\",\"token\":\"<PaaS token>\"}"

For Linux-based Service Fabric clusters, replace oneAgentWindows with oneAgentLinux.

Install Dynatrace OneAgent VM extension via PowerShell

Replace all values marked with <...> with your actual values.

  1. Open a PowerShell window and sign in to your Microsoft Azure account.
Login-AzureRmAccount
  1. Add the Dynatrace OneAgent Azure VM extension to the VM.
Set-AzureRmVmExtension
  -Name Dynatrace
  -ResourceGroupName "<resource group name>"
  -VMName "<VM name>"
  -ExtensionType oneAgentWindows
  -Publisher dynatrace.ruxit
  -TypeHandlerVersion 1.99
  -AutoUpgradeMinorVersion $true
  -Location "<insert location here>"
  -Settings @{ "tenantId"="<your environment ID>"; "token"="<PaaS token>" }

If you're using Dynatrace Managed, be sure to add the server address to the settings JSON. The value should include the address only, without https:// or any subpaths.

-Settings @{ "server"="<Dynatrace Managed URL>"; "tenantId"="<YourEnvironmentID>"; "token"="<PaaStoken>" }

For Linux-based Service Fabric clusters, replace oneAgentWindows with oneAgentLinux.

Install Dynatrace OneAgent Azure VM extension via ARM template

By adding the following snippet to your ARM template, Dynatrace OneAgent will be added to new VMs automatically.

{
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "name": "[concat(parameters('vmName'),'/', parameters('vmExtensionName'))]",
  "apiVersion": "2015-05-01-preview",
  "location": "[resourceGroup().location]",
  "dependsOn": [
    "[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
  ],
  "properties": {
    "publisher": "dynatrace.ruxit",
    "type": "oneAgentWindows",
    "typeHandlerVersion": "1.99",
    "settings": {
      "tenantId": "<your environment ID>",
      "token": "<PaaS token>"
    }
  }
}

If you're using Dynatrace Managed, be sure to add the server address to the settings JSON. The value should include the address only, without https:// and without any subpaths.

"settings": {
  "tenantId": "<your environment ID>",
  "token": "<PaaS token>",
  "server": "<Dynatrace Managed URL>"
}

For Linux-based Service Fabric clusters, replace oneAgentWindows with oneAgentLinux.