question

DavidDowning-2679 avatar image
DavidDowning-2679 asked ·

Azure Lab Services REST API

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-automation
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SamaraSoucyMSFT avatar image
SamaraSoucyMSFT answered ·

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"
 }
1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.