The following forum(s) have migrated to Microsoft Q&A (Preview): Azure DevTest Labs!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Passing parameters to specialized VM instance when creating lab RRS feed

  • Question

  • Hi,

    I'm fairly new to DevTest labs, but have experience of ARM templates from creating Marketplace images.

    I have a DevTest lab that creates an environment of 8 VMs from specialized images - these are used for manual demo/testing environments. I would like to obtain some info during the lab creation (email address) and then inject that into one of the VM images so that I can send an email to that address once the lab is created with some lab specific info in it. 

    I do something similar with license info in a Marketplace image, but that embeds the .ps1 file into the marketplace package, then defines a VM extension in the template to run that script on VM creation.

    I guess this is done in devTest labs using an artifact script? however I want this to be a mandatory script (so the user doesn't have to select the artifact at lab creation time) and it looks like mandatory artifacts can't contain parameters!

    Can someone who has more experiance with DevTest labs please suggest a mechanism that I can use to take a parameter provided by the user during lab creation (from the Azuredeploy.json) and inject that data into one of the specialized VM instances that I'm creating?

    Thanks,

    Mark


    Thursday, November 8, 2018 10:11 AM

Answers

  • OK, I figured out a way to do it :-)

    I added the CustomScript extension to the VM definition, with no FileURI and just used CommandToExecute to run a powershell command that echoed the parameter out to a file on the local file system (in a known location) - I'll then be using a scheduled task that runs on startup on that specialized VM image, waits for that file to be created, and then uses the contents as an input parameter to send out the email :-)

    Might be useful for anyone else who wants to do the same thing.

    Cheers,

    Mark.

    Thursday, November 8, 2018 11:38 AM