Hello, I would like to ask, if I understand it correctly.
Even so, that MMA agent (MS windows) is capable to join multiple workspaces, powershell cmd-let Set-AzureRmVMExtension is unable to configure that MMA agent correctly?
Thanks for info
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for the question! We are investigating and will update you shortly.
@roiyz-msft @@MGoedtel Can either of you please help confirm on this one? Thanks. :)
There are some comments about this in another GitHub issue as well.
@mchmelaroriflame - The Set-AzureRMVMExtension is only intended to install the VM Extension for Log Analytics agent and not configure it afterwards to report to another workspace or a different one. To do that you would use some PowerShell code, Azure Policy, or you could consider using Azure Automation DSC to accomplish this. The PowerShell code would look something like this -
$workspaceId = 'AddWorkspaceId'
$workspaceKey = 'AddWorkspacePriKey'
$mma = New-Object -ComObject 'AgentConfigManager.MgmtSvcCfg'
if ($mma.GetCloudWorkspace($workspaceId).workspaceid -ne $workspaceId)
{
$mma.AddCloudWorkspace($workspaceId, $workspaceKey)
$mma.ReloadConfiguration()
$mma.GetCloudWorkspace($workspaceId).ConnectionStatusText
Write-Verbose "Host $env:COMPUTERNAME is now configured for $workspaceId" -Verbose
}
else
{
Write-Warning "Host $env:COMPUTERNAME already configured for $workspaceId"
}
Hope that helps.
@mchmelaroriflame Thanks for bringing this to our attention. We will now close this issue. If there are further questions regarding this matter, please tag me in a comment. I will reopen it and we will gladly continue the discussion.
Most helpful comment
@mchmelaroriflame - The Set-AzureRMVMExtension is only intended to install the VM Extension for Log Analytics agent and not configure it afterwards to report to another workspace or a different one. To do that you would use some PowerShell code, Azure Policy, or you could consider using Azure Automation DSC to accomplish this. The PowerShell code would look something like this -
$workspaceId = 'AddWorkspaceId'
$workspaceKey = 'AddWorkspacePriKey'
Hope that helps.