Deploy OneAgent on Azure Functions

Note

Azure Functions support is currently in Beta and provides only limited support for pre-compiled Azure Functions that are written in .NET, running on Windows, and operated on an "App Service Plan".

Dynatrace provides an Azure Site-Extension to install OneAgent on Azure Functions. 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 an OneAgent default version is configured.

Agent updates aren't automatically provided through OneAgent. For more information on 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 is routed through an ActiveGate, you need to configure the communication endpoint used by the extension.

<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 the Azure Function Service where you want to add OneAgent.

  2. Under the tab Platform features select Site 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, so the extension is installed.

  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 directly by browsing to the extension using https://<Your-AppService-Subdomain>.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 OneAgen and monitor progress/status until OneAgent is installed. Azure Site-Extension Status

  3. Enable instrumentation

Note

While Azure Function support is in Beta you need to set some Application setting manually to enable the deep monitoring of your Azure Functions.

Azure Functions Configuration

The required settings are shown in the extensions UI

Azure Functions config

  1. Finally, you need to restart the function to recycle the function's worker process, allowing OneAgent to monitor your application.

Note: To reliably restart your function processes, use Stop/Start.

Create Custom Services for your Functions

During Beta, you're required to create a custom service for your Azure Functions.

A typical Azure Functions has a "Run" method with a signature like this:

public static System.Threading.Tasks.Task'1<System.Net.Http.HttpResponseMessage> Run System.Net.Http.HttpRequestMessage, System.String, Microsoft.Azure.WebJobs.Host.TraceWriter) (Html-Triggered-Function)

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