The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Azure DevTest Labs!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
Azure Lab service deployment using ARM template RRS feed

  • Question

  • I am trying to provision Azure lab services through arm template. First I have manually created Lab service account, lab and template. Published and created vms based on a  marketplace image. Same thing I want to automate using ARM template. I was able to achieve till creation of template in Lab. However I am unable to find ARM code block to Publish the Lab template. I have browsed though GIT hub but could not find the same. There is Azure API to do the same. But Need to do this in ARM template. Please help ? 

    Below is the template that I am using

    {
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "labServiceAccountName": {
          "defaultValue": "labsa",
          "type": "String"
        },
        "labName": {
          "defaultValue": "lab1",
          "type": "String"
        },
        "labUserName": {
          "defaultValue": "labadmin",
          "type": "String"
        },
        "labUserPassword": {
          "defaultValue": "Password@123",
          "type": "securestring"
        },
        "labs_ml_lab_XXXXXX_externalid": {
          "defaultValue": "/subscriptions/XXXXX/resourceGroups/XXXXX/providers/microsoft.devtestlab/labs/ml-lab-XXXX",
          "type": "String"
        }
      },
      "variables": {},
      "resources": [
        {
          "type": "microsoft.labservices/labaccounts",
          "apiVersion": "2018-10-15",
          "name": "[parameters('labServiceAccountName')]",
          "location": "westcentralus",
          "properties": {
            "enabledRegionSelection": false,
            "provisioningState": "Succeeded",
            "uniqueIdentifier": "[uniqueString(resourceGroup().id)]"
          }
        },
        {
          "type": "microsoft.labservices/labaccounts/galleryimages",
          "apiVersion": "2018-10-15",
          "name": "[concat(parameters('labServiceAccountName'), '/windows 10 pro, version 1903')]",
          "dependsOn": [
            "[resourceId('microsoft.labservices/labaccounts', parameters('labServiceAccountName'))]"
          ],
          "properties": {
            "isEnabled": true,
            "isOverride": false,
            "provisioningState": "Succeeded"
          }
        },
        {
          "type": "microsoft.labservices/labaccounts/labs",
          "apiVersion": "2018-10-15",
          "name": "[concat(parameters('labServiceAccountName'), '/', parameters('labName'))]",
          "location": "westcentralus",
          "dependsOn": [
            "[resourceId('microsoft.labservices/labaccounts', parameters('labServiceAccountName'))]"
          ],
          "properties": {
            "maxUsersInLab": 10,
            "usageQuota": "PT5H",
            "userAccessMode": "Restricted",
            "provisioningState": "Succeeded",
            "uniqueIdentifier": "[uniqueString(resourceGroup().id)]"
          }
        },    
        {
          "type": "microsoft.labservices/labaccounts/labs/environmentsettings",
          "apiVersion": "2018-10-15",
          "name": "[concat(parameters('labServiceAccountName'), '/',parameters('labName'),'/default')]",
          "location": "southcentralus",
          "dependsOn": [
            "[resourceId('microsoft.labservices/labaccounts/labs', parameters('labServiceAccountName'), parameters('labName'))]",
            "[resourceId('microsoft.labservices/labaccounts', parameters('labServiceAccountName'))]",
            "[resourceId('microsoft.labservices/labaccounts/galleryimages', parameters('labServiceAccountName'), 'windows 10 pro, version 1903')]"
          ],
          "properties": {
            "configurationState": "Completed",
            "description": "[concat(parameters('labName'),'Image')]",
            "title": "[concat(parameters('labName'),'Image')]",
            "resourceSettings": {
              "galleryImageResourceId": "[resourceId('microsoft.labservices/labaccounts/galleryimages', parameters('labServiceAccountName'), 'windows 10 pro, version 1903')]",
              "size": "Standard",
              "referenceVm": {
                "userName": "[parameters('labUserName')]",
                "password": "[parameters('labUserPassword')]"
              }
            },
            "provisioningState": "Succeeded",
            "uniqueIdentifier": "[uniqueString(resourceGroup().id)]"
          }
        },
        {
          "type": "microsoft.labservices/labaccounts/labs/environmentsettings/environments",
          "apiVersion": "2018-10-15",
          "name": "[concat(parameters('labServiceAccountName'),  '/',parameters('labName'),'/default/ml-envvm-207644829')]",
          "location": "westcentralus",
          "dependsOn": [
            "[resourceId('microsoft.labservices/labaccounts/labs/environmentsettings', parameters('labServiceAccountName'), parameters('labName'), 'default')]",
            "[resourceId('microsoft.labservices/labaccounts/labs', parameters('labServiceAccountName'), parameters('labName'))]",
            "[resourceId('microsoft.labservices/labaccounts', parameters('labServiceAccountName'))]"
          ],
          "properties": {
            "resourceSets": {
              "vmResourceId": "[concat(parameters('labs_ml_lab_XXXXXX_externalid'), '/virtualmachines/ml-envvm-00000')]",
              "resourceSettingId": "1"
            },
            "provisioningState": "Succeeded",
            "uniqueIdentifier": "[uniqueString(resourceGroup().id)]"
          }
        },
        {
          "type": "microsoft.labservices/labaccounts/labs/environmentsettings/environments",
          "apiVersion": "2018-10-15",
          "name": "[concat(parameters('labServiceAccountName'),  '/',parameters('labName'),'/default/ml-envvm-875218953')]",
          "location": "westcentralus",
          "dependsOn": [
            "[resourceId('microsoft.labservices/labaccounts/labs/environmentsettings', parameters('labServiceAccountName'), parameters('labName') , 'default')]",
            "[resourceId('microsoft.labservices/labaccounts/labs', parameters('labServiceAccountName'), parameters('labName'))]",
            "[resourceId('microsoft.labservices/labaccounts', parameters('labServiceAccountName'))]"
          ],
          "properties": {
            "resourceSets": {
              "vmResourceId": "[concat(parameters('labs_ml_lab_XXXXXX_externalid'), '/virtualmachines/ml-envvm-00001')]",
              "resourceSettingId": "1"
            },
            "provisioningState": "Succeeded",
            "uniqueIdentifier": "[uniqueString(resourceGroup().id)]"
          }
        }
      ]
    }

    Wednesday, October 23, 2019 6:57 AM

All replies

  • Hello Dpras,

    Thank you for reaching out to us. Apologies for the delay here. 

    • You will not be able to publish a lab through ARM Templates since it is a POST Action. 

    • You can only perform PUT, PATCH operation using ARM Templates. 

    •  POST and DELETE operations are not possible. 

    I hope this information helps. Please feel free to revert back with any questions you might have. 

    If a post helps to resolve your issue, please click “Mark as Answer” and/or “Vote as helpful”. By marking a post as Answered and/or Helpful, you help others find the answer faster.  Thanks.

    Friday, December 6, 2019 2:23 PM
    Owner