Commands to install the Azure Datadog Extension

Install on Azure

Datadog provides an Azure extension to assist with Agent deployment on Azure instances:

An alternative to the GUI installation is the command line. To run the Datadog Agent in your Azure instances as an extension, use the command that matches your environment. Replace <SITE_PARAMETER> with your Datadog account site parameter value in the Datadog sites page, and <DATADOG_API_KEY> with your Datadog API key.

Set-AzVMExtension -Name "DatadogAgent" -Publisher "Datadog.Agent" -Type "DatadogWindowsAgent" -TypeHandlerVersion "5.0" -Settings @{"site" = "<SITE_PARAMETER>"; "agentVersion" = "latest"} -ProtectedSettings @{"api_key" = "<DATADOG_API_KEY>"} -DisableAutoUpgradeMinorVersion

More information on the syntax to set Azure instance extensions can be found in the Azure Extension Set-AzVMExtension documentation.

The Azure Extension can accept both normal settings and protected settings.

The normal settings include:

VariableTypeDescription
siteStringSet the Datadog intake site, for example: SITE=
agentVersionStringThe Agent version to install, following the format x.y.z or latest
agentConfigurationURI(optional) Url to the Azure blob contaning the Agent configuration as a zip.
agentConfigurationChecksumStringThe SHA256 checksum of the Agent configuration zip file, mandatory if agentConfiguration is specified.

The protected settings include:

VariableTypeDescription
api_keyStringAdds the Datadog API KEY to the configuration file.

Note: If agentConfiguration and api_key are specified at the same time, the API key found in the agentConfiguration takes precedence. Also note that if an API key is set on the target machine, it’s not possible to change it with Set-AzVMExtension.

Specifying a configuration URI

This example shows how to specify a configuration for the Datadog Agent to use. The Datadog Agent configuration URI must be an Azure blob storage URI. The Datadog Windows Agent Azure Extension will check that the agentConfiguration URI comes from the .blob.core.windows.net domain. The Datataog Agent configuration should be created from the %PROGRAMDATA%\Datadog folder.

Set-AzVMExtension -Name "DatadogAgent" -Publisher "Datadog.Agent" -Type "DatadogWindowsAgent" -TypeHandlerVersion "5.0" -Settings @{"site" = "<SITE_PARAMETER>"; "agentConfiguration" = "https://<CONFIGURATION_BLOB>.blob.core.windows.net/<FILE_PATH>.zip"; "agentConfigurationChecksum" = "<SHA256_CHECKSUM>"} -DisableAutoUpgradeMinorVersion

Note: Once the Datadog Agent is installed, the configuration can only be changed when upgrading to a newer version.

Set a specific version of the Agent

This example shows how to specify a version of the Agent to install. By default the Datadog Windows Agent Azure Extension will install the latest version of the Datadog Agent.

Note: Downgrades are not supported, so it’s not possible to install a lower version of the Datadog Agent than the one currently installed on the target machine. To install a lower version of the Datadog Agent, uninstall the previous version first by removing the Datadog Windows Agent Azure Extension on the target machine. Removing the Datadog Windows Agent Azure Extension does not remove the Datadog Agent configuration.

Set-AzVMExtension -Name "DatadogAgent" -Publisher "Datadog.Agent" -Type "DatadogWindowsAgent" -TypeHandlerVersion "5.0" -Settings @{"site" = "<SITE_PARAMETER>"; "agentVersion" = "latest"} -ProtectedSettings @{"api_key" = "<DATADOG_API_KEY>"} -DisableAutoUpgradeMinorVersion
az vm extension set --publisher "Datadog.Agent" --name "DatadogLinuxAgent" --version 7.0 --settings '{"site":"datadoghq.com", "agentVersion":"latest"}' --protected-settings '{"api_key":"<DATADOG_API_KEY>"}' --no-auto-upgrade-minor-version
More information on the syntax to set Azure instance extensions can be found in the [Azure Extension CLI reference][1].

The Azure Extension can accept both normal settings and protected settings.

The normal settings include:

VariableTypeDescription
siteStringSet the Datadog intake site, for example: SITE=
agentVersionStringThe Agent version to install, following the format x.y.z or latest
agentConfigurationURI(optional) URI to the Azure blob containing the Agent configuration as a zip.
agentConfigurationChecksumStringThe SHA256 checksum of the Agent configuration zip file, mandatory if agentConfiguration is specified.

The protected settings include:

VariableTypeDescription
api_keyStringAdds the Datadog API KEY to the configuration file.

Note: If agentConfiguration and api_key are specified at the same time, the API key found in the agentConfiguration takes precedence. If an API key is set on the target machine, it’s not possible to change it with the api_key setting.

Specifying a configuration URI

This example shows how to specify a configuration for the Datadog Agent to use.

  • The Datadog Agent configuration URI must be an Azure blob storage URI.
  • The Datadog Linux Agent Azure Extension checks that the agentConfiguration URI comes from the .blob.core.windows.net domain.
  • The Datataog Agent configuration should be created from the /etc/datadog-agent/ folder.
az vm extension set --publisher "Datadog.Agent" --name "DatadogLinuxAgent" --version 7.0 --settings '{"site":"datadoghq.com", "agentVersion":"latest", "agentConfiguration":"https://<CONFIGURATION_BLOB>.blob.core.windows.net/<FILE_PATH>.zip", "agentConfigurationChecksum":"<SHA256_CHECKSUM>"}' --protected-settings '{"api_key":"<DATADOG_API_KEY>"}' --no-auto-upgrade-minor-version

Install on Azure Arc

To run the Datadog Agent in your Azure Arc instances as an extension, use the command that matches your environment.

az connectedmachine extension create --name <NAME> --machine-name <MACHINE_NAME> -g <RESOURCE_GROUP> --publisher Datadog.Agent --type DatadogWindowsAgent --location <LOCATION> --settings '{"site":"<SITE_PARAMETER>"}' --protected-settings '{"api_key":"<DATADOG_API_KEY>"}'
az connectedmachine extension create --name <NAME> --machine-name <MACHINE_NAME> -g <RESOURCE_GROUP> --publisher Datadog.Agent --type DatadogLinuxAgent --location <LOCATION> --settings '{"site":"<SITE_PARAMETER>"}' --protected-settings '{"api_key":"<DATADOG_API_KEY>"}'

More information on the syntax to set Azure connectedmachine extensions can be found in the az connectedmachine extension page.

Further reading