Azure Lab Services REST API

David Downing 701 Reputation points
2020-02-13T18:25:52.723+00:00

I'm trying to call a REST API to set the "Auto-shutdown of virtual machines". I thought it would be on the Create Lab API, but I can't seem to find it.

Any assistance is greatly appreciated.

Thank you,
David

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.
279 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Samara Soucy - MSFT 21 Reputation points
    2020-02-19T19:28:32.95+00:00

    Hi David,

    Version 2019/01/01-preview documenation isn't publicly available for Lab Services, but the property exists on that version of the to set the auto shutdown in the labaccounts endpoint. Keep in mind that as a preview endpoint, this could change in the future.

    You would need to take the Create/Update endpoint and change the API version:

    PUT https://management.azure.com/subscriptions/{TenantID}/resourcegroups/{ResourceGroup}/providers/microsoft.labservices/labaccounts/{LabName}?api-version=2019-01-01-preview  
    

    The Properties section has more options in this version. In particular, I think you are looking for the idleGracePeriod
    and the idleShutdownMode options.

    {  
        "id": "/subscriptions/{TenantID}/resourcegroups/{ResourceGroup}/providers/microsoft.labservices/labaccounts/{LabName}",  
        "location": "eastus2",  
        "name": "{LabName}",  
        "properties": {  
            "clientConnections": "Disabled",  
            "enabledRegionSelection": false,  
            "geo": "unitedstates",  
            "idleGracePeriod": "PT10M",  
            "idleShutdownMode": "OnDisconnect",  
            "labServicesObjectId": "",  
            "provisioningState": "Succeeded",  
            "sizeConfiguration": null,  
            "uniqueIdentifier": "db132e95-bb93-4902-9598-0ecbb7917ca4",  
            "virtualNetworkResourceId": null  
        },  
        "tags": {  
        },  
        "type": "Microsoft.LabServices/labAccounts"  
    }