How to Add the OMS Client to a VM Scale Set

How to Add the OMS Client to a VM Scale Set

I was asked by a customer to add the OMS client to an Azure VM ScaleSet (VMSS). This is not documented directly for a VMSS, though it is for Azure VMs. After some asking around and some experimentation, I was able to successfully deploy the OMS agent to the VMSS using the following PowerShell:

select-azurermsubscription -subscriptionid ‘your subscription id’ $PublicSettings = @{"workspaceId" = "your oms workspace id"} $ProtectedSettings = @{"workspaceKey" = "your big base64 oms key"}

# Get information about the scale set $vmss = Get-AzureRmVmss -ResourceGroupName ‘VMSSRESOURCEGROUP’ ` -VMScaleSetName ‘VMSSNAME’

Add-AzureRmVmssExtension ` -VirtualMachineScaleSet $vmss ` -Name "Microsoft.EnterpriseCloud.Monitoring" ` -Publisher "Microsoft.EnterpriseCloud.Monitoring" ` -Type "MicrosoftMonitoringAgent" ` -TypeHandlerVersion 1.0 ` -AutoUpgradeMinorVersion $true ` -Setting $PublicSettings ` -ProtectedSetting $ProtectedSettings

# Update the scale set and apply the Custom Script Extension to the VM instances Update-AzureRmVmss ` -ResourceGroupName $vmss.ResourceGroupName ` -Name $vmss.Name ` -VirtualMachineScaleSet $vmss

# Only needed for manual update VMSS – warning tells them all to update, so modify to suit $jobs=@() Get-AzureRmVmssVM -ResourceGroupName $vmss.ResourceGroupName -VMScaleSetName $vmss.Name | foreach { $jobs+=Update-AzureRmVmssInstance -ResourceGroupName $vmss.ResourceGroupName -Name $vmss.Name -InstanceId $_.InstanceId -AsJob }

$jobs | Wait-Job $jobs | Receive-Job

References Azure VMSS Azure Operations Management Suite (OMS) Azure VM OMS Agent

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

TOP