You can use Azure CloudService Startup Tasks to perform operations before a role starts. Using such a task you can run the OneAgent to get fullstack visibility into your Azure Cloud-Services.
The following instructions provide scripts to download and run the Dynatrace OneAgent installer. The integration is the same for Web- and Workerroles.
To use the integration, you need the Dynatrace Environment ID and API Token. For more details how to retrieve those values see Dynatrace Help
If you're using Dynatrace Managed or your communication should be routed through a specific ActiveGate, you need to configure your custom communication endpoint.
The URL pattern for the API endpoint is as follows: https://YourDynatraceServerURL/e/YourEnvironmentID
YourDynatraceServerURL and YourEnvironmentID need to be replaced.
- Add the InstallDynatraceInCloudService.ps1 and startup-dynatrace.cmd to your CloudService project in Visual Studio.
Make sure the newly added files are configured to be copied to the output directoy when the application is packagged.
-
Add the additional settings Dynatrace.EnvironmentID and Dynatrace.APIToken to your ServiceDefination.csdef file. Optionally add Dynatrace.ConnectionPoint if you are required to use an alternative communication endpoint.
-
Add a startup task in your ServiceDefinition.csdef to run startup-dynatrace.cmd at role startup. See here
-
Add the configuration values in your ServiceConfiguration.*.cscfg file's.
This is the script for your startup-task, which simply executes powershell running the installer script.
This script is responsible for downloading and installing the Dynatrace OneAgent.
Since the startup task is run every role start, the script checks the various CloudService lifecycle events to ensure it's only installed once at initial provisioning of the virtual machine.
Example service definition file showing the addtional Dynatrace settings as well as the configuration for the startup task.
Example configuration file showing the additional configuration related to the additional settings defined in the ServiceDefination.csdef file.
For troubleshooting you can remotely log into your role instance and access the installer log found at c:\Dynatrace-Install.log.
In case no log is written, verify that your scripts are included in your application package and/or your path to your startup startup task is correct.
