question

DavidDowning-2679 avatar image
0 Votes"
DavidDowning-2679 asked DavidDowning-2679 answered

Azure Lab Services REST API Schedule Lab

I'm trying to automate creating a lab schedule but I cannot see an API listed in the documentation. Is this possible?

Thank you,
David

azure-lab-services-automation
5 |1600 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.

DavidDowning-2679 avatar image
0 Votes"
DavidDowning-2679 answered

I was able to schedule a lab using the following:

PUT URL:

https://management.azure.com/subscriptions/{SubscriptionID}/resourcegroups/LSRG1/providers/microsoft.labservices/labaccounts/LABACCT01/labs/LAB01/environmentsettings/LAB01ES/schedules/LAB01Schedule01?api-version=2019-01-01-preview

Body:

{
"properties": {
"start": "2020-05-1T15:00:00.000Z",
"end": "2020-05-31T17:00:00.000Z",
"recurrencePattern": {
"frequency": "Weekly",
"weekDays": [ "Tuesday" ],
"interval": 1,
"until": "2020-06-19T22:59:59.000Z"
},
"timeZoneId": "Eastern Standard Time",
"startAction": {
"enableState": "Enabled",
"actionType": "Start"
},
"endAction": {
"enableState": "Enabled",
"actionType": "Stop"
},
"notes": ""
}
}

Thank you for your assistance.

5 |1600 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.

SamaraSoucyMSFT avatar image
1 Vote"
SamaraSoucyMSFT answered DavidDowning-2679 edited

There is an undocumented endpoint in the 2019-01-01-preview API that allows this. As a preview feature, it is subject to change at any time.

The endpoint is:

 PUT https://management.azure.com/subscriptions/{TenantID}/resourcegroups/{ResourceGroup}/providers/microsoft.labservicesl/labaccounts/{LabAccountName}/labs/{LabName}/environmentsettings/default/schedules/{ScheduleName}?api-version=2019-01-01-preview

And an example of the body is:

 {
     "properties": {
         "start": "2020-02-19T15:00:00.000Z",
         "end": "2020-02-19T17:00:00.000Z",
         "recurrencePattern": {
             "frequency": "Weekly",
             "weekDays": ["Tuesday"],
             "interval": 1,
             "until": "2020-06-19T22:59:59.000Z"
         },
         "timeZoneId": "Eastern Standard Time",
         "startAction": {
             "enableState": "Enabled",
             "actionType": "Start"
         },
         "endAction": {
             "enableState": "Enabled",
             "actionType": "Stop"
         },
         "notes": ""
     }
 }


· 2
5 |1600 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.