FIX: Please set stopOnMultipleConnections to false in public settings

Azure Automation the basics.

Within Azure Automation an option has been added to update your servers. You can find this under Update Management. Because there is an option to add servers that are not in Azure, this may replace WSUS servers in the future, but for now I only use it for servers within Azure.

I thoroughly tested the tool in my developer tenant, but unfortunately my developer tenant is not linked to the company SCOM environment.

I wanted to start a pilot after testing with a client with 10 servers in Azure. I expected this to go smoothly, but to my surprise I got the following error message: “Please set stopOnMultipleConnections to false in public settings”

When I tried to install the agent from the Azure Portal, I received the error message as in the screenshot below.

Please set stopOnMultipleConnections to false in public settings
Please set stopOnMultipleConnections to false in public settings

By clicking the error I got a more detailed error message:

VM has reported a failure when processing extension ‘MicrosoftMonitoringAgent’. Error message: “This machine is already connected to another Log Analytics workspace, or managed by System Center Operations Manager. Please set stopOnMultipleConnections to false in public settings or remove this property, so this machine can connect to new workspaces. Note that this machine may be billed multiple times for each workspace it report to.” 

This machine is already connected to another Log Analytics workspace, or managed by System Center Operations Manager. Please set stopOnMultipleConnections to false in public settings or remove this property, so this machine can connect to new workspaces
Don’t copy the error message. It looks ridiculously bad.

The error message was clear for me. We use SCOM to monitor the servers. I couldn’t update the monitoring agents because the SCOM agent was already installed. Although the error message was clear, I wasn’t sure how to do that. Took me awhile to figure out and that’s why I made a tutorial.


Lets fix  ‘Set stopOnMultipleConnections to false in public settings’.

Before you start with the tutorial, keep in mind what the setting does. It’s possible that the agent will communicate with two OMS workspaces and you’ll have to pay double for the VMs.

Log in to portal.azure.com and open the Microsoft Operation Management Suite (OMS).

  1. Click the gearwheel in the top-right cornor
  2. Open Connected Sources 
  3. Click Windows servers
  4. Copy the workspace ID and Primary Key
This machine is already connected to another Log Analytics workspace, or managed by System Center Operations Manager.
This machine is already connected to another Log Analytics workspace, or managed by System Center Operations Manager.

The trick here is that we’ll have to deploy the Monitoring Agent  with PowerShell.

Open PowerShell_ISE  (Control + R > Powershell_ISE)

Log on to Azure

Login-AzureRmAccount

Select the correct subscription

select-azurermsubscription -subscriptionid YOURSUBSCRIPTIONID

Now copy/paste the following script, but change the settings to your own settings.

  • WorkspaceId
  • WorkspaceKey
  • My location is West Europe, yours can be different.

You’ve already copied them from a previous step.

Beware! This script will install the extension for all virtual machines in your tenant.
If that’s not what your want, copy the script between the foreach loop {} and set the VM and ResourceGroupName yourself.

$vms = get-azurermvm

$PublicSettings = @{"workspaceId" = "WORKSPACEIDHERE";"stopOnMultipleConnections" = $false}

$ProtectedSettings = @{"workspaceKey" = "WORKSPACEKEYHERE"}

foreach ($vm in $vms){

write-output$vm.name

Set-AzureRmVMExtension -ExtensionName "Microsoft.EnterpriseCloud.Monitoring" `

-ResourceGroupName $vm.resourcegroupname`

-VMName $vm.name`

-Publisher "Microsoft.EnterpriseCloud.Monitoring"`

-ExtensionType "MicrosoftMonitoringAgent"`

-TypeHandlerVersion 1.0`

-Settings $PublicSettings`

-ProtectedSettings $ProtectedSettings`

-Location 'West Europe'

}

We’ll set the StopOnMultipleConnections to false in the PublicSettings.

If you run this script:

get-AzureRmVMExtension-VMName VMNAME-ResourceGroupName RESOURCEGROUPNAME -Name "Microsoft.EnterpriseCloud.Monitoring"

It will show that the settings are correct.


Recap

Even though this is probably the future, I still have a lot of problems with this tool and I think it is not mature enough yet.

For example, you can’t install 2 hybrid workers on 1 server, so managing centrally from 1 Automation and OMS is a difficult problem.

I hope that these changes will be implemented, but for the time being I will stick to one customer and wait for a while.


A little extra

This post contains PowerShell. Would you like to learn the basics better? I have created a new website to learn basic PowerShell in an ’emulator’ environment.
Click here to go learn Basic PowerShell.

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work as a PowerShell DevOps Engineer. In my spare time I write about interesting stuff that I encounter during my work.

2 thoughts on “FIX: Please set stopOnMultipleConnections to false in public settings”

Leave a Reply

Your email address will not be published. Required fields are marked *