Updating Azure Lab Services lab capacity via Rest API

VinceO 26 Reputation points
2021-04-26T20:14:49.277+00:00

We are using the Azure Lab Services REST APIs to automate some tasks. One of the tasks we are trying to automate is updating the Lab capacity and Users based on data from a third-party registration application.

For example, the registration application will be enabled two months before the class. 1 week before the class the registration application will be disabled. After it is disabled, we plan to run a program to make Azure Lab Services API calls to set the Lab capacity and create users. We are unable to update the Lab capacity via the API (no errors, however it is not updated).

We also tried “Azure REST API Try It” (https://video2.skills-academy.com/en-us/rest/api/labservices/labs/update) but were unsuccessful. Get and List API calls for Labs are successful.

Here are some details from “Try It”

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}?api-version=2018-10-15

The request body entered is:
{
"properties.maxUsersInLab": 4
}

92243-image1.png

The Response Code in “Try It” is 200, however the Lab capacity (properties.maxUsersInLab) was not updated.

Any thoughts on what we are missing?

Azure Lab Services
Azure Lab Services
An Azure service that is used to set up labs for classrooms, trials, development and testing, and other scenarios.
297 questions
0 comments No comments
{count} votes

Accepted answer
  1. kobulloc-MSFT 26,321 Reputation points Microsoft Employee
    2021-04-28T18:19:35.66+00:00

    @VinceO We're seeing the same thing. The PATCH call is not fully supported yet (this should get support in an upcoming release, possibly the next API version) , however the full PUT call does work as long as all properties are passed.

    The recommendation for automating labs is to use PowerShell as you said. Some people have used PowerShell in runbooks for automated tasks. The PowerShell reference for Azure Lab Services can be found here:

    https://video2.skills-academy.com/en-us/azure/lab-services/reference-powershell-module

    Another option for creating several labs at once is the recently updated Bulk Operations library:

    https://github.com/Azure/azure-devtestlab/tree/master/samples/ClassroomLabs/Modules/Library/BulkOperations

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. I-Cat 76 Reputation points
    2021-04-26T20:37:11.623+00:00

    The url is from 2018 looks like your only outdated by 3 years

    0 comments No comments

  2. Vincent 1 Reputation point
    2021-04-26T21:40:40.783+00:00

    Thanks for noticing. It was the default for "TryIt". I did find version "2019-01-01-preview", but nothing more recent. The preview version was also unsuccessful.

    0 comments No comments

  3. VinceO 26 Reputation points
    2021-04-27T18:30:19.987+00:00

    Looks like the APIs are not able to update this property.

    Here is feedback from Microsoft: I would like to inform you that we are actively investigating as apparently this action is not possible using REST API and az commands should be used instead.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.