Share via

install oms extension on linux, CLI ERROR

Arif Usman 436 Reputation points
Aug 3, 2022, 3:37 PM

FOLKS: I want to install OMS extension on Linux VMs using Azure CLI and for this I am using below code. but getting error
Failed to parse JSON: {workspaceKey: "efasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf=="}
Error detail: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
here is my code: (i replace original workspacekey, workspaceid,rg, vm name)
az vm extension set --name OmsAgentForLinux --publisher Microsoft.EnterpriseCloud.Monitoring --version 1.* --no-auto-upgrade --no-wait --force-update --protected-settings '{"workspaceKey": "efasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf=="}' --settings '{"workspaceId":"1111111-1111-1111-b111-00fb111111111"}' --resource-group "myresourcegroup-rg" --vm-name "MYVM03"

227776-oms-cli-error.png

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,551 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 20,587 Reputation points Microsoft Employee
    Aug 4, 2022, 2:12 AM

    @Arif Usman You can add --debug parameter to Azure CLI command to get further details on the same or you can use --help to see the example commands.

    One of the suggestions based on the stack overflow posts below, that worked is escaping the quotes with \"
    Please try that and let me know if you are still seeing issues.

    Here are few other threads on Stack overflow for the same issue that might help:

    https://stackoverflow.com/questions/60819537/expecting-property-name-enclosed-in-double-quotes-when-passing-json-string-to-az

    https://stackoverflow.com/questions/43119958/azure-cli-2-how-to-provide-parameters-in-az-group-deployment-create-command

    https://stackoverflow.com/questions/58100088/create-azure-vm-with-artifact-switch

    0 comments No comments

  2. Arif Usman 436 Reputation points
    Aug 4, 2022, 2:32 PM

    @KarishmaTiwari-MSFT thanks for your reply.
    This is what i have tried.

    ======================================================================================================

    $logsSetting = '{"workspaceKey": "efasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf=="}'.Replace("'",'\"')
    $metricsSetting = '{"workspaceId":"1111111-1111-1111-b111-00fb111111111"}'.Replace("'",'\"')

    az vm extension set --name OmsAgentForLinux `  
        --publisher Microsoft.EnterpriseCloud.Monitoring --version 1.* --no-auto-upgrade --no-wait --force-update `  
        --protected-settings $logsSetting `  
        --settings $metricsSetting `  
        --resource-group "myresourcegroup-rg" `  
        --vm-name "MYVM03"  
    

    ==========================================================================================================

    this is the error i am getting:

    Error detail: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
    The JSON may have been parsed by the shell. See https://learn.microsoft.com/cli/azure/use-cli-effectively#use-quotation-marks-in-arguments


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.