0

I'm trying to create a VM via the CLI and add an artifact from the public repo in a dev test lab.

Here is my script: az lab vm create --resource-group TestRG --lab-name TestLab --name 'ScriptVM' --image "Windows 10 Pro, Version 1809" --image-type gallery --size 'Standard_B2s' --admin-username 'user' --admin-password 'pw' --artifacts '{ "/artifactsources/publicrepo/artifacts/linux-java" }'

I don't know the format of the artifacts switch though as it just says a JSON encoded array. How does this work? I just get the error Expecting property name enclosed in double quotes: line 1 column 3 (char 2)

DasDave
  • 801
  • 1
  • 9
  • 28

2 Answers2

1

So the answer was I didn't have all the required elements in the JSON. I also fell foul of escaping quotation marks in the PS script. The final switch ended up looking like this:--artifacts '[{"""artifactId""": """artifacts/windows-notepadplusplus"""}]'

DasDave
  • 801
  • 1
  • 9
  • 28
0

The following example shows the sections that make up the basic structure of a definition file:

{
  "$schema": "https://raw.githubusercontent.com/Azure/azure-devtestlab/master/schemas/2016-11-28/dtlArtifacts.json",
  "title": "",
  "description": "",
  "iconUri": "",
  "targetOsType": "",
  "parameters": {
    "<parameterName>": {
      "type": "",
      "displayName": "",
      "description": ""
    }
  },
  "runCommand": {
    "commandToExecute": ""
  }
}

It resides in your Git repo and is referenced in the AZ command. A video of the entire process can be found in our documentation.

https://learn.microsoft.com/en-us/azure/lab-services/devtest-lab-artifact-author

Ken W - Zero Networks
  • 3,533
  • 1
  • 13
  • 18