Deploy OneAgent on Azure App Service

Dynatrace provides an Azure Site-Extension to install OneAgent on Azure App Services. Site Extensions are the native extension mechanism provided via Kudu, which is the deployment management engine behind Azure App Services.

Azure Site-Extension

How the Site Extension for OneAgent works

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.

Agent updates aren't automatically provided through OneAgent. For more information about how updates are applied, see How to update OneAgent on App Services

Prerequisites

To use the extension, you need your Dynatrace Environment ID and API Token.

How to retrieve your Environment ID and API Token

Environment ID

  1. Login with your Dynatrace account.

  2. Select Deploy Dynatrace from the navigation menu.

  3. Click the Set up PaaS integration button. Your environment ID appears in the Environment ID text box.

  4. Click Copy to copy the ID to the clipboard. You can do this at any time by revisiting this page.

PaaS Token

The PaaS token is used in combination with your environment ID to download the OneAgent installer. Go to Deploy Dynatrace > Set up PaaS integration to access the InstallerDownload token. For security reasons, it's recommended that you create discrete tokens for different environments.

To generate a new token

  1. Click the Generate new token button.

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

  3. Click Generate to create the token. The newly created token will appear in the list below.

  4. 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.

Additional configuration parameters

Server URl
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.

<YourDynatraceServerURL> and <YourEnvironmentID> need to be replaced. The URL pattern for the API endpoint is as follows: https://<YourDynatraceServerURL>/e/<YourEnvironmentID>/api

Installation

Azure Resource Manager provides a consistent management layer to perform tasks through Azure PowerShell, Azure CLI, Azure portal, REST API, and client SDKs.

Install the Site Extension for OneAgent

  1. Navigate to tje App Service where you want to add the OneAgent.

  2. Select Extensions and click Add.
    Add Azure Site-Extension

  3. Select Dynatrace OneAgent from the list of extensions. Azure Site-Extension

  4. Accept the legal terms and click OK to install the extension.

  5. To activate and access the extension you need to restart Kudu. Restart Kudu

Configure the Site Extension for OneAgent

The extension comes with its own UI for easier configuration.

  1. Access the extensions UI through either the "Browse" link in the portal... Installed Azure Site-Extension

...or by directly browsing to the extension using https://.scm.azurewebsites.net/dynatrace/`

For more details on how to access the Kudu service and its extensions see Accessing the Kudu service.

  1. Apply the configuration as required Configure Azure Site-Extension

  2. Click Install OneAgent and monitor progress/status until indicating that OneAgent is installed. Azure Site-Extension Status

  3. Finally, restart the App Service to recycle the applications worker process, allowing OneAgent to monitor your application.

Note: To reliably restart your applcations worker process, use Stop/Start.

Overriding OneAgent configuration

The following parameters can be used to set/override default configurations

Parameter Description
DT_CONNECTION_POINT Semi-colon separated list of communication-endpoints

Using multiple deployment slots

As Azure App Service deployment slots are treated like full-fledged application service instances, you need to enable the Site-Extension for OneAgent on each deployment slot you want monitored by Dynatrace.

For details on configuring deployment slots, see Microsoft Documentation - Staged Publishing.

If you're using application settings to additionally configure certain OneAgent options, make sure the additional settings are also applied to the deployment slots as well.

Troubleshooting

503 Service Unavailable for Web App and Kudo

The Site Extension for OneAgent registers IIS modules. If registration is complete but the actual IIS module files aren't in place (or corrupt), the App Service may return a 503 Service Unavailable message. Also, the Kudo AppPool will no longer be available, which effectively means that you can no longer fix your installation via Kudu.

Solution

By adding the following setting in Application Settings

WEBSITE_PRIVATE_EXTENSIONS=0

Deactivate all site extensions.

This setting gives you access to Kudo once again. Re-install the site extension and set WEBSITE_PRIVATE_EXTENSIONS=1 (or remove the setting entirely). Following application restart, everything should work again, including Dynatrace monitoring.