Here a short post about adding an Azure ARM Virtual Machine to the Operations Management Suite. Janaka Rangama already explained here how you can do this with Azure ARM templates. But in my case I wanted to use PowerShell instead of the ARM templates. The nice thing is that we can re-use the same extension through PowerShell. With some small adjustments we can use this extension to add the Microsoft Monitoring Agent to the VM and configure the Microsoft Monitoring Agent for your OMS workspace.

With the following PowerShell lines you can add the Microsoft Monitoring Agent extension to a Virtual Machine:

$rgname “<< Resource Group Name >>”

$VMName “<< Virtual Machine Name >>”

$LocName “<< Azure Region Name >>”

$string1 = ‘{  “workspaceId”: “<< WORKSPACE ID >>” }’

$string2 ‘{ “workspaceKey”: “<< WORKSPACE KEY >>” }’

Set-AzureRmVMExtension  -ResourceGroupName $rgName -ExtensionType “MicrosoftMonitoringAgent” -TypeHandlerVersion “1.0” -Name “JoinOMS” -VMName $vmName -Location $locName  -SettingString $string1 -ProtectedSettingString $string2 -Publisher “Microsoft.EnterpriseCloud.Monitoring”

When you change above variables and then execute these lines the extension will be added to your Virtual Machine and the Microsoft Monitoring Agent will be installed and configured:

Extension Status:

Microsoft Monitoring Agent Applet in the VM:

With above scenario we’ve added another way of installing the Microsoft Monitoring Agent and configuring it for OMS.

Have Fun!