Azure Dev Test Lab

This page shows how to write Terraform and Azure Resource Manager for Dev Test Lab and write them securely.

azurerm_dev_test_lab (Terraform)

The Lab in Dev Test can be configured in Terraform with the resource name azurerm_dev_test_lab. The following sections describe 8 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "azurerm_dev_test_lab" "default" {
  name                = var.name
  resource_group_name = var.resource_group_name
  location            = var.location
  storage_type        = var.storage_type
  tags                = var.tags
azurerm_dev_test.tf#L6
resource "azurerm_dev_test_lab" "lab" {
  location            = azurerm_resource_group.rg.location
  name                = var.dev_test_lab_name
  resource_group_name = azurerm_resource_group.rg.name
  tags                = module.tags.tags
}
lab.tf#L1
resource "azurerm_dev_test_lab" "lab" {
  name                = var.lab_name
  location            = azurerm_resource_group.lab.location
  resource_group_name = azurerm_resource_group.lab.name
main.tf#L7
resource "azurerm_dev_test_lab" "this" {
  location            = var.location
  name                = var.name
  resource_group_name = var.resource_group_name
  storage_type        = var.storage_type
  tags                = var.tags
main.tf#L7
resource "azurerm_dev_test_lab" "this" {
  location            = var.location
  name                = var.name
  resource_group_name = var.resource_group_name
  storage_type        = var.storage_type
  tags                = var.tags
devtestlab.tf#L8
resource "azurerm_dev_test_lab" "ds-dtl" {
  name                = "ds-devtestlab"
  location            = azurerm_resource_group.dtl-rg.location
  resource_group_name = azurerm_resource_group.dtl-rg.name

devtestlab.tf#L8
resource "azurerm_dev_test_lab" "ds-dtl" {
  name                = "ds-devtestlab"
  location            = azurerm_resource_group.dtl-rg.location
  resource_group_name = azurerm_resource_group.dtl-rg.name

main.tf#L30
resource "azurerm_dev_test_lab" "main" {
  name                = format("%s", var.dev_test_lab_settings.name)
  resource_group_name = local.resource_group_name
  location            = local.location
  storage_type        = var.dev_test_lab_settings.storage_type
  tags                = merge({ "Name" = format("%s", var.dev_test_lab_settings.name) }, var.tags, )

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Dev Test Lab.

Microsoft.DevTestLab/labs (Azure Resource Manager)

The labs in Microsoft.DevTestLab can be configured in Azure Resource Manager with the resource name Microsoft.DevTestLab/labs. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

createLab.json#L18
      "type": "Microsoft.DevTestLab/labs",
      "name": "[parameters('newLabName')]",
      "location": "[resourceGroup().location]",

      "properties": {
          "labStorageType":"Standard"
template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "labs_coursapi_name": {
test.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "labs_lab1_name": {
test.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "labs_lab1_name": {
04-devtest-labs-artifacts.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "devTestLabsName": {
10-devtest-labs-users.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "admin": {
template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "labs_coursapi_name": {
formulaTemplate.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "existingLabName": {
lab_template.json#L22
      "type": "Microsoft.DevTestLab/labs",
      "location": "[parameters('regionId')]",
      "properties": {
        "labStorageType": "Premium"
      },
      "resources": [
lab_template.json#L22
      "type": "Microsoft.DevTestLab/labs",
      "location": "[parameters('regionId')]",
      "properties": {
        "labStorageType": "Premium"
      },
      "resources": [

Parameters

  • apiVersion required - string
  • location optional - string

    The location of the resource.

  • name required - string

    The name of the lab.

  • properties required
      • announcement optional
          • enabled optional - string

            Is the lab announcement active/enabled at this time?.

          • expirationDate optional - string

            The time at which the announcement expires (null for never)

          • expired optional - boolean

            Has this announcement expired?

          • markdown optional - string

            The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown.

          • title optional - string

            The plain text title for the lab announcement

      • environmentPermission optional - string

        The access rights to be granted to the user when provisioning an environment.

      • extendedProperties optional - string

        Extended properties of the lab used for experimental features

      • labStorageType optional - string

        Type of storage used by the lab. It can be either Premium or Standard. Default is Premium.

      • mandatoryArtifactsResourceIdsLinux optional - array

        The ordered list of artifact resource IDs that should be applied on all Linux VM creations by default, prior to the artifacts specified by the user.

      • mandatoryArtifactsResourceIdsWindows optional - array

        The ordered list of artifact resource IDs that should be applied on all Windows VM creations by default, prior to the artifacts specified by the user.

      • premiumDataDisks optional - string

        The setting to enable usage of premium data disks. When its value is 'Enabled', creation of standard or premium data disks is allowed. When its value is 'Disabled', only creation of standard data disks is allowed.

      • support optional
          • enabled optional - string

            Is the lab support banner active/enabled at this time?.

          • markdown optional - string

            The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown.

  • tags optional - string

    The tags of the resource.

  • type required - string

Frequently asked questions

What is Azure Dev Test Lab?

Azure Dev Test Lab is a resource for Dev Test of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Dev Test Lab?

For Terraform, the vijay-project/terra_action, cjthorpe/terraform-azure-code and faroukfriha/azure-as-code source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the mikenelson-io/DevTestLabs, mikenelson-io/DevTestLabs and henrikmotzkus/AzureShortcuts source code examples are useful. See the Azure Resource Manager Example section for further details.