cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Installing OneAgent VM Extension in Azure via PowerShell in Infra Only mode

JonathanV
Newcomer

Hi All,

 

I recently did a OneAgent deployment to a large volume of Virtual Machines in Azure via PowerShell and noticed that the Dynatrace Documentation doesnt cover how to install the Dynatrace OneAgent VM Extension in Infrastructure Only Mode. (The Documentation uses the depreciated AzureRM Module and doesnt cover the syntax for the settings to enable Infrastructure Only mode on installation). Thought i would drop this here in case anyone runs into the same issue, hopefully it makes someone's life a little easier.

 

This script can be modified to suit any specific situation, in this example you can simply export the VM's from the Virtual Machine blade in Azure into a csv (in this case i targeted windows VM's) and change the column header "Resource Group" to "ResourceGroup". Good for large deployments where you only want to target a single subscription at a time for a rollout. Simply fill in the < >

 

Remember to Import the .Az module and use Get-AzSubscription to find the correct subscription ID and then Set-AzContext -Subscription <Subscription ID Here> to set the context to the desired subscription

 

PowerShell Script:

$Importfile=Import-csv <File Path Here>

Foreach ($Import in $Imports) {

$ResourceGroup=$Import.ResourceGroup

$VMName=$Import.Name

$Location=$Import.Location

 

Set-AzVmExtension -Name Dynatrace.OneAgent -Publisher dynatrace.ruxit -ResourceGroupName $ResourceGroup -Location $Location -VMName $Name -ExtensionType "oneAgentwindows" -TypeHandlerVersion "1.0" -NoWait -Settings @{ "tenantId"="<TenantID Here>"; "token"="<Token Here>"; "enableLogAnalytics"="yes"; “installerArguments”=”--set-infra-only=true --set-host-group=<Host Group Name Here>” } -erroraction continue }

2 REPLIES 2

ChadTurner
DynaMight Legend
DynaMight Legend

Great Tip @JonathanV 

-Chad

Ados1234
Newcomer_

Nice one Jonathan, do I require admin privileges to the VM to be able to carry out the installation? Also must I log in to the VMs be able to carry out the installation 

Featured Posts