ARM template or Azure CLI command to only add artifact to an existing vm in devtest lab.

MADHUN Ahmed 241 Reputation points
2021-10-28T14:16:04.59+00:00

I have a Devtest lab and a few VMs within it created by the same ARM template.

One of the VM requires to have an extra artifact, which I can add manually via Artifact's tab within the Azure portal.
I am looking for a way to automate this process via an ARM template to update, or Azure CLI command.

Any suggestion?
The artifact i am adding is a windows chocolatey package install for windows.

Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
255 questions
0 comments No comments
{count} votes

Accepted answer
  1. MADHUN Ahmed 241 Reputation points
    2021-11-10T15:34:36.13+00:00

    It seems that there is a better template to use as my answer here: 7199438

    [
    {
    "artifactId": "/artifactSources/public repo/artifacts/windows-chocolatey",
    "parameters": [
    {
    "name": "packages",
    "value": "sqlserver-odbcdriver"
    },
    {
    "name": "allowEmptyChecksums",
    "value": "true"
    },
    {
    "name": "ignoreChecksums",
    "value": "false"
    }
    ]
    }
    ]

    Command:

    az lab vm apply-artifacts --artifacts "@AddChocolateyArtifact.json" --lab-name "DTL_Name" --name "VM_Name" --resource-group "RG_Name"

    Reference: 13267

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. shiva patpi 13,141 Reputation points Microsoft Employee
    2021-10-30T18:09:56.117+00:00

    Hello @MADHUN Ahmed ,
    Can you try out the example mentioned in the below article:
    https://stackoverflow.com/questions/60289997/how-to-apply-artifact-run-powershell-for-azure-devtest-lab-vm-by-azure-cli

    There was a ARM template where it uses the section "CommandToExecute" under RunCommand.
    To apply the template use the command below:
    az lab vm apply-artifacts --artifacts '@artifacts.json' --lab-name MyLab --name MyVirtualMachine --resource-group MyResourceGroup

    Probably in your specific scenario to add windows chocolate package use the ARM template mentioned at https://github.com/Azure/azure-devtestlab/blob/master/Artifacts/windows-chocolatey/Artifactfile.json

    There is also a powershell script:- https://learn.microsoft.com/en-us/azure/devtest-labs/add-artifact-vm#use-powershell

    Regards,
    Shiva.