Home

How to install oms extension on Linux VMs using CLI

%3CLINGO-SUB%20id%3D%22lingo-sub-288328%22%20slang%3D%22en-US%22%3EHow%20to%20install%20oms%20extension%20on%20Linux%20VMs%20using%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-288328%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20There%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20install%20OMS%20extension%20on%20Linux%20VMs%20using%20Azure%20CLI%20and%20for%20this%20I%20am%20using%20below%20code.%20But%20not%20sure%20why%20there%20are%20two%20values%20with%26nbsp%3B%3CSPAN%3EworkspaceKey%20and%20omskey%20as%20well%20as%26nbsp%3BworkspaceId%20and%20omsid.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Eare%20they%20referring%20any%20two%20different%20key%20and%20IDs%3F%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eaz%20vm%20extension%20set%20%5C%3CBR%20%2F%3E--resource-group%20myResourceGroup%20%5C%3CBR%20%2F%3E--vm-name%20myVM%20%5C%3CBR%20%2F%3E--name%20OmsAgentForLinux%20%5C%3CBR%20%2F%3E--publisher%20Microsoft.EnterpriseCloud.Monitoring%20%5C%3CBR%20%2F%3E--version%201.7%20--protected-settings%20'%7B%22workspaceKey%22%3A%20%22omskey%22%7D'%20%5C%3CBR%20%2F%3E--settings%20'%7B%22workspaceId%22%3A%20%22omsid%22%7D'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-288328%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAgents%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowershell%20and%20Rest%20API%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-481356%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20install%20oms%20extension%20on%20Linux%20VMs%20using%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481356%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F184511%22%20target%3D%22_blank%22%3E%40Gourav%20Kumar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20an%20old%20thread%20and%20I%20am%20not%20sure%20if%20you%20already%20found%20a%20solution.%20But%20I%20wanted%20to%20reply%20just%20in%20case%20you%20haven't.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERunning%20a%20CLI%20command%20in%20PowerShell%2C%20the%20double%20quotes%20are%20handled%20differently.%20You%20need%20to%20add%20back-slash%20escape%20characters%26nbsp%3B%20before%20the%20double%20quotes.%20Example%20below.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E.......%3C%2FP%3E%3CP%3E%3CSPAN%3E--protected-settings%20'%7B%22workspaceKey%22%3A%20%3CSTRONG%3E%5C%22%3C%2FSTRONG%3Eomskey%3CSTRONG%3E%5C%22%3C%2FSTRONG%3E%7D'%20%5C%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E--settings%20'%7B%22workspaceId%22%3A%20%3CSTRONG%3E%5C%22%3C%2FSTRONG%3Eomsid%3CSTRONG%3E%5C%22%3C%2FSTRONG%3E%7D'%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-288610%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20install%20oms%20extension%20on%20Linux%20VMs%20using%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-288610%22%20slang%3D%22en-US%22%3E%3CP%3ETried%20but%20no%20luck%2C%20same%20as%20earlier.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-288521%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20install%20oms%20extension%20on%20Linux%20VMs%20using%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-288521%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20only%20thing%20that%20I%20noticed%20is%20the%20examples%20in%20MS%20Docs%26nbsp%3Bonly%20shows%20single%20quotes%20around%20protected-settings%20and%20settings.%26nbsp%3B%20Try%20removing%20them%20from%20the%20rest%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-288384%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20install%20oms%20extension%20on%20Linux%20VMs%20using%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-288384%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Travis%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20just%20missed%20%3A%20in%20the%20script%2C%20Now%20able%20to%20understand%20it%20properly.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20whenever%20i%20tried%20to%20execute%20this%20script%20i%20am%20getting%20%22%3CSTRONG%3EExpecting%20property%20name%20enclosed%20in%20double%20quotes%3A%20line%201%20column%202%20(char%201)%3C%2FSTRONG%3E%22%20error%20on%20screen.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20you%20please%20help%20me%20to%20fix%20this.%20I%20have%20also%20attached%20screenshot%20for%20further%20reference%20%3A%20-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60172iB83BF9669DE89012%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Linux%20CLI%20extension.JPG%22%20title%3D%22Linux%20CLI%20extension.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-288336%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20install%20oms%20extension%20on%20Linux%20VMs%20using%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-288336%22%20slang%3D%22en-US%22%3ETry%20replacing%20omsid%20with%20the%20actual%20workspace%20ID%20and%20omskey%20with%20the%20primary%20or%20secondary%20key%20from%20the%20workspace.%20Both%20can%20be%20found%20in%20advanced%20settings%20in%20the%20workspace%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-487079%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20install%20oms%20extension%20on%20Linux%20VMs%20using%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-487079%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F325744%22%20target%3D%22_blank%22%3E%40asimvirtual%3C%2FA%3E%26nbsp%3BThanks%20for%20the%20reply%2C%20I%20will%20give%20a%20go%20and%20get%20back%20to%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Gourav Kumar
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.

@Gourav Kumar 

 

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.