1
votes

I have an Azure pipeline that creates a new DevTest Lab VM from an Azure Resource Manager (ARM) template. That works great but a new resource group is created for the VM. I would like to specify an existing resource group the VM should belong to but I can't figure out how to configure this in the Azure DevTest Labs Create VM task or in the ARM template JSON file.

I found one example that provided a resourceGroup parameter as part of the resources object in the JSON but that that gives me an invalid template error:

...
"resources": [
        {
            ...
            "type": "Microsoft.DevTestLab/labs/virtualmachines",
            "name": "[variables('vmName')]",
            "resourceGroup": "[parameters('cdResourceGroup')]",
            ...
        }
]
...

This seems like something that should be fairly straightforward but I haven't been able to find this documented.

1
When you say 'that doesn't seem to work', does that mean there is an error or the VM still doesn't get deployed to the specified resource group?Stringfellow
I should have been more clear. I get an invalid template error.nick
I'm beginning to think this is a limitation of DevTest Lab VMs. They can belong to their own resource group that is created with the VM or the lab can be configured so that all resources belong to the same resource group.nick

1 Answers

0
votes

What I am trying to do is not supported. Looking for other solutions.

Azure DevTest Lab VMs cannot belong to existing resource groups (besides the lab's common resource group). The lab can be configured so that all VMs in the lab belong to a single common resource group or each VM will belong to it's own resource group that is created with the VM (the default). See this Azure DevTest Labs FAQ.

To configure via the Azure portal: Select the lab > "Configuration and policies" > "Lab settings"