How to install oms extension on Linux VMs using CLI

Brass Contributor

Hi There,

 

I want to install OMS extension on Linux VMs using Azure CLI and for this I am using below code. But not sure why there are two values with workspaceKey and omskey as well as workspaceId and omsid.

 

are they referring any two different key and IDs? 

 

az vm extension set \
--resource-group myResourceGroup \
--vm-name myVM \
--name OmsAgentForLinux \
--publisher Microsoft.EnterpriseCloud.Monitoring \
--version 1.7 --protected-settings '{"workspaceKey": "omskey"}' \
--settings '{"workspaceId": "omsid"}'

 

 

 

6 Replies
Try replacing omsid with the actual workspace ID and omskey with the primary or secondary key from the workspace. Both can be found in advanced settings in the workspace

Hi Travis,

 

I just missed : in the script, Now able to understand it properly. 

 

But whenever i tried to execute this script i am getting "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" error on screen.

 

Could you please help me to fix this. I have also attached screenshot for further reference : -

 

 

Linux CLI extension.JPG

 

 

The only thing that I noticed is the examples in MS Docs only shows single quotes around protected-settings and settings.  Try removing them from the rest?

Tried but no luck, same as earlier.

@GouravIN 

 

This is an old thread and I am not sure if you already found a solution. But I wanted to reply just in case you haven't.

 

Running a CLI command in PowerShell, the double quotes are handled differently. You need to add back-slash escape characters  before the double quotes. Example below. 

 

.......

--protected-settings '{"workspaceKey": \"omskey\"}' \
--settings '{"workspaceId": \"omsid\"}' 

 

Hope this helps

@asimvirtual Thanks for the reply, I will give a go and get back to you.