Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have the following Powershell command

Set-AzVMExtension -ExtensionName "MicrosoftMonitoringAgent" `
                -ResourceGroupName "rg-xxxx" `
                -VMName "vm-xxxx" `
                -Publisher "Microsoft.EnterpriseCloud.Monitoring" `
                -ExtensionType "MicrosoftMonitoringAgent" `
                -TypeHandlerVersion "1.0" `
                -Settings @{"workspaceId" = "xxxx" } `
                -ProtectedSettings @{"workspaceKey" = "xxxx"} `
                -Location "uksouth"

which successfully replaces all Log Analytic Workspaces on the VM with the one I have configured in the command. What I want to do is only add the workspace without replacing the ones already configured.

ARM has the same behaviour. It looks like if there is one workspace already then this gets overwritten, if there are two workspaces there, one of them gets overwritten.

Does anyone know any method within Powershell to only add a workspace and not overwrite? Thanks, Neil.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

When we use the Log Analytics agent virtual machine extension to install Log Analytics agent on Azure VM, we just can enrolls virtual machines into one existing Log Analytics workspace. Every time we install the extension, Microsoft will replace the old configuration file. For more details, please refer to here.

If you want to add a workspace, please refer to the document


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...