azurepowershellartifactsazure-devtest-labs

How to apply-artifact "Run PowerShell" for azure devtest lab VM by Azure CLI?


I have a PowerShell script and would like to use az lab vm -apply-artifacts to add the artifacts to VM. Could anyone please give me an example artifact Json file and how to call it from Azure CLI? Thanks a lot!


Solution

  • give me an example artifact Json file and how to call it from Azure CLI?

    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": ""
      }
    }
    

    And you cuold get a sample artifacts.json definition file. Check out the artifacts created by the DevTest Labs team in GitHub repository.

    Apply artifacts to a virtual machine in Azure DevTest Lab.

    az lab vm apply-artifacts --artifacts '@artifacts.json' --lab-name MyLab --name MyVirtualMachine --resource-group MyResourceGroup