Problem
Update Management in Azure does not support system workspace. If you are using Security Center in Azure, the chances are; all your VM’s are allocated to the system workspace that Security Center created.
The selected workspace is a system workspace and cannot be linked to this account
The other error you can get is when you try enable Update Management on VM, and that VM is in another Workspace.
The selected Automation account is already linked to a Long Analytics workspace that is not the selected workspace
Solution
Deallocate All VM’s that you want to use Update Management from the System Workspace to a New Workspace.
- In OMS enable Update Management and Create a New Workspace
- Open the Workspace associated with Update Management and note the
- Workspace ID
- Workspace Primary Key
- Run the following Powershell Scripts
- Disconnect-AllVirtualMachinesFromWorkspace
- Connect-AllVirtualMachinesToWorkspace -omsID “12345…” -omsKey “12345…==”
function Disconnect-AllVirtualMachinesFromWorkspace { $typeWin = "MicrosoftMonitoringAgent" $typeLin = "OmsAgentForLinux" $windows = Get-AzureRmVm | Where { $_.StorageProfile.OsDisk.OsType -eq "Windows" } foreach ($vm in $windows) { Remove-AzureRmVMExtension -ResourceGroupName "$($vm.ResourceGroupName)" -Name $typeWin -VMName "$($vm.Name)" -Force } $linux = Get-AzureRmVm | Where { $_.StorageProfile.OsDisk.OsType -eq "Linux" }-Force foreach ($vm in $linux) { Remove-AzureRmVMExtension -ResourceGroupName "$($vm.ResourceGroupName)" -Name $typeLin -VMName "$($vm.Name)" -Force } } function Connect-AllVirtualMachinesToWorkspace { param( [Parameter(Mandatory=$true, HelpMessage="Workspace Id")] [string] $omsId, [Parameter(Mandatory=$true, HelpMessage="Workspace Primary Key")] [string] $omsKey ) $typeWin = "MicrosoftMonitoringAgent" $typeLin = "OmsAgentForLinux" $PublicSettings = New-Object psobject | Add-Member -PassThru NoteProperty workspaceId $omsId | ConvertTo-Json $protectedSettings = New-Object psobject | Add-Member -PassThru NoteProperty workspaceKey $omsKey | ConvertTo-Json $windows = Get-AzureRmVm | Where { $_.StorageProfile.OsDisk.OsType -eq "Windows" } foreach ($vm in $windows) { Set-AzureRmVMExtension -ExtensionName $typeWin -ResourceGroupName "$($vm.ResourceGroupName)" -VMName "$($vm.Name)" -Publisher "Microsoft.EnterpriseCloud.Monitoring" -ExtensionType $typeWin -TypeHandlerVersion 1.0 -SettingString $PublicSettings -ProtectedSettingString $protectedSettings -Location $vm.location } $linux = Get-AzureRmVm | Where { $_.StorageProfile.OsDisk.OsType -eq "Linux" }-Force foreach ($vm in $linux) { Set-AzureRmVMExtension -ExtensionName $typeLin -ResourceGroupName "$($vm.ResourceGroupName)" -VMName "$($vm.Name)" -Publisher "Microsoft.EnterpriseCloud.Monitoring" -ExtensionType $typeLin -TypeHandlerVersion 1.0 -SettingString $PublicSettings -ProtectedSettingString $protectedSettings -Location $vm.location } }