如何将Azure Scale Set添加到Log Analytics。从日志分析中,我可以看到虚拟机,但与虚拟机不同,未启用连接按钮。我需要做什么。启用此连接。
答案 0 :(得分:1)
有关此问题的MSDN帖子:
https://blogs.msdn.microsoft.com/timomta/2018/04/09/how-to-add-the-oms-client-to-a-vm-scale-set/
正如文章中提到的,我们解释了如何针对VM执行此操作,而不针对VMSS。您可以通过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